Can API Gateway be used as Websocket client?

0

Hello,

Is it possible to initiate a WebSocket connection from AWS Gateway, or otherwise set up a Serverless/lambda-based connection to an AWS-external Websocket interface? And if so, how?

Any API Gateway/Websocket question/article/tutorial/example I've come across is about hosting a WebSocket API and having clients connect to it, and not the other way around.

The only related question Ive seen is this one but it has not been answered yet: https://stackoverflow.com/questions/69173955/can-i-connect-to-websocket-api-as-a-client-from-aws-api-gateway

Any pointers or help would be much appreciated

1 Answer
0
Accepted Answer

No, API Gateway only supports incoming web sockets (and also REST) connections. If you want to initiate a connection to some other service, you will need to write code, using some web sockets library, that runs in a container, to establish the connection. You can't use a Lambda function to run this code, unless you expect the connection to be short lived (up to 15 minutes).

profile pictureAWS
EXPERT
Uri
answered 2 years ago
profile picture
EXPERT
reviewed 3 months 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