Amazon API Gateway to ECS AWS Fargate cluster

API Gateway → VPC Link → Application Load Balancer → AWS Fargate

Create an API Gateway endpoint to an ECS Fargate cluster.

This pattern allows integration of public API Gateway endpoint to a private Application Load Balancer with an ECS Fargate cluster behind it.
It allows to build a secure pattern without exposing the private subnet resources and can be accessed only via a VPC Link.
The SAM template in this pattern deploys the following resources. It requires a VPC id and private subnet ids as inputs. It is assumed that the VPC and subnets are already configured with the required network routes.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-vpclink-pvt-alb

Deploy

sam deploy --guided


Testing

See the repo for detailed testing notes.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Bideep Bezbaruah

Bideep Bezbaruah

Principal Architect/Engineer. I have built various distributed systems and cloud architectures, modernized and migrated applications to AWS for multiple large enterprise customers.