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 réponse
0
Réponse acceptée

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
répondu il y a un mois
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions