Amazon API Gateway to Private ALB and ECS Cluster via VPC Link

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

Create an API Gateway endpoint to an ECS Fargate cluster.

This sample project demonstrates an integration pattern that allows configuring a 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.
This pattern creates the following resources: Requried Security Groups, ECS Fargate cluster with service and task definitions, Private Application Load Balancer with appropriate listener and target group, VPC Link. API gateway integration between the API endpoint and the private ALB via the VPC Link.

< 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-vpclink-pvt-alb-terraform

Deploy

terraform initterraform apply --auto-approve


Testing

See the repo for detailed testing notes.

Cleanup

Delete the stack: terraform destroy --auto-approve.

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.