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

iamnick
已提问 1 个月前357 查看次数
1 回答
0
已接受的回答

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
专家
Uri
已回答 1 个月前
profile picture
专家
已审核 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则