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 Risposta
0
Risposta accettata

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
ESPERTO
Uri
con risposta un mese fa
profile picture
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande