AWS Lambda Managed Instances with AWS SAM (Python)

AWS Lambda → Managed Instances (EC2)

Deploy a Python Lambda function on AWS-managed Amazon EC2 instances with multi-concurrency, AWS Graviton support, and EC2 pricing advantages.

This pattern creates a Lambda Capacity Provider with VPC configuration and deploys a Python function that runs on managed EC2 instances.
Lambda handles instance lifecycle, OS patching, routing, and auto-scaling while you benefit from EC2 pricing models.
Multi-concurrency allows one execution environment to handle multiple invocations simultaneously.

< 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/lambda-managed-instances-python-sam

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete

Created by:

Ajaya Shrestha

Ajaya Shrestha

Cloud Support Engineer at AWS specializing in Lambda and serverless architectures.