ALB with route-based listener rules to AWS Lambda

Application Load Balancer → AWS Lambda

This pattern creates an Application Load Balancer with route-based listener rules, paired with an AWS Lambda function as the target.

Deploy an Application Load Balancer, with routes that direct traffic to an AWS Lambda function. The function uses the AWS Lambda Powertools for Python library. The Lambda function records details of the incoming ALB event, along with the API and context objects, logging them to an Amazon CloudWatch Logs log group and Amazon X-Ray.

< 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/alb-lambda-rest-api-sam-py

Deploy

sam validate && sam build && sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

sam delete

Created by:

Balasubrahmanya Balakrishna

Balasubrahmanya Balakrishna

Senior Lead Software Engineer, Capital One Services, LLC.

Follow on LinkedIn