Skip to content

Conversation

@agawanea
Copy link
Contributor

@agawanea agawanea commented Dec 3, 2025

Issue #, if available:
#2871

This pattern demonstrates REST API Gateway integration with a private Application Load Balancer and ECS Fargate cluster using VPC Link V2 (SAM implementation).

What's included:

  • REST API Gateway with proxy integration
  • VPC Link V2 for private connectivity to ALB
  • Private Application Load Balancer
  • ECS Fargate cluster with nginx
  • Complete security groups and IAM roles
  • AWS SAM implementation

Tested in: us-east-1

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This pattern demonstrates how to integrate a REST API Gateway with a private
Application Load Balancer and ECS Fargate cluster using VPC Link V2.

Key features:
- REST API Gateway with proxy integration
- VPC Link V2 for private integration
- Private ALB routing to ECS Fargate
- Security groups and IAM roles
- Uses existing VPC and subnets
This pattern demonstrates how to integrate a REST API Gateway with a private
Application Load Balancer and ECS Fargate cluster using VPC Link V2.

Key features:
- REST API Gateway with proxy integration
- VPC Link V2 for private integration
- Private ALB routing to ECS Fargate
- Security groups and IAM roles
- AWS SAM implementation
- Uses existing VPC and subnets
@ellisms
Copy link
Contributor

ellisms commented Dec 19, 2025

@agawanea This PR mentions the SAM implementation, but I also see a TF directory included. Which one is correct?

agawanea and others added 2 commits December 22, 2025 12:55
The Terraform implementation is in a separate branch/PR. This branch should only contain the SAM implementation of the apigw-rest-vpclink-pvt-alb pattern.
@agawanea
Copy link
Contributor Author

Removed the terraform pattern. This PR is only for SAM pattern. Terraform is in different PR

@ellisms
Copy link
Contributor

ellisms commented Jan 5, 2026

Thanks. I started testing the SAM template and am encountering this error:

This AWS::ApiGateway::Method resource is in a CREATE_FAILED state.

Resource handler returned message: "IntegrationTarget is required for VpcLinkV2 mex0t5. (Service: ApiGateway, Status Code: 400, Request ID: 4f8ff301-8541-46b9-aa05-4d580f2b0cdb) (SDK Attempt Count: 1)" (RequestToken: 520b34e0-a9a8-2618-3ff3-3f008fd39ded, HandlerErrorCode: InvalidRequest)

As I looked through the template, the APIGW resource isn't a "SAM" APIGW resource, it is a standard CloudFormation resource. Is there a chance to convert the APIGW resource to AWS::Serverless::API and define the API with an OpenAPI spec file?

- Replace CloudFormation API Gateway resources with AWS::Serverless::Api
- Add external OpenAPI definition file (api.yaml) with AWS::Include transform
- Add integrationTarget parameter for VPC Link V2 to ALB integration
- Update README to document SAM resource usage and OpenAPI file
- Update testing instructions with correct path examples
- Update copyright year to 2025
- Tested and validated: API Gateway -> VPC Link V2 -> Internal ALB -> ECS working correctly
@agawanea
Copy link
Contributor Author

agawanea commented Jan 6, 2026

Added the SAM resource and tested it to be working fine now

Copy link
Contributor

@ellisms ellisms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @agawanea - requesting a few remaining changes before we can publish.

- Use full AWS service names throughout (Amazon API Gateway, Amazon VPC Link V2, Amazon Application Load Balancer, Amazon ECS)
- Add problem statement explaining VPC Link V2 eliminates NLB requirement
- Add --capabilities CAPABILITY_NAMED_IAM flag to deployment command
- Simplify outputs to only include REST API endpoint URL
- Update copyright year to 2026
@agawanea agawanea requested a review from ellisms January 7, 2026 06:39
@ellisms
Copy link
Contributor

ellisms commented Jan 7, 2026

Thanks @agawanea . I'll add this to the publishing queue.

@julianwood julianwood merged commit 76e7031 into aws-samples:main Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants