How do I integrate API Gateway Web Socket with Internal NLB?

0

I have a backend service running on ECS and NLB Internal in front of it. I am using the below model for REST API: API Gateway REST API -> Internal NLB -> ECS

Currently, we are developing more chat features via WebSocket, is there any path for this model: API Gateway Web Socket -> Internal NLB -> ECS. Is this approach possible or do I have to create a public NLB or ALB for the WebSocket?

Thank you

1 Answer
0
Accepted Answer

API Gateway supports web sockets only from the client to the gateway itself. From the gateway to the backend (ECS behind NLB in your case), API gateway sends regular HTTP requests, i.e., for every messages API Gateway receives on the socket, it sends an HTTP request to the backend with the message in the payload. When the backend wants to send a message to the client, it sends an HTTP request to the @connections end point and ask the gateway to send the message to the client.

If you want a websocket all the way to your backend, you can't use API Gateway and you need to expose your NLB/ALB.

profile pictureAWS
EXPERT
Uri
answered a month ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions