WebSocket API integration with ALB and Amazon ECS

API Gateway WebSocket API → Application Load Balancer → AWS Fargate

Creates a WebSocket API and integrates with ECS Fargate using ALB.

This sample project integrates a WebSocket API with ALB and Amazon ECS Fargate.
A WebSocket client connects to the API endpoint url using the default route. Using http integration, API Gateway communicates with ALB which invokes a Fargate task. The Fargate task running FASTAPI framework receives the POST request and communicates back to API Gateway using the connectionId in the request context.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-websocket-api-fargate-cdk

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

cdk destroy

Created by:

Rajesh Sitaraman

Cloud Application Architect @ AWS.

Follow on LinkedIn