Posted On: Dec 14, 2023

AWS Lambda now supports creating serverless applications using Python 3.12. Developers can use Python 3.12 as both a managed runtime and a container base image, and AWS will automatically apply updates as they become available. You can use Python 3.12 with Lambda@Edge, allowing you to customize low-latency content delivered through Amazon CloudFront. Powertools for AWS Lambda (Python), a developer toolkit to implement serverless best practices and increase developer velocity, also supports Python 3.12. 

The Lambda Python 3.12 runtime is built on the new Amazon Linux 2023 runtime, which provides a significantly smaller deployment footprint than earlier Amazon Linux 2-based runtimes, updated versions of common libraries such as glibc, and a new package manager. The runtime also includes improved Unicode handling and support for graceful shutdown. For more information, see our blog post at Python 3.12 runtime now available in AWS Lambda.

The Python 3.12 runtime is available in all Regions where Lambda is available, except for China and GovCloud Regions.

You can use the full range of AWS deployment tools, including the Lambda console, AWS CLI, AWS Serverless Application Model (AWS SAM), CDK, and AWS CloudFormation to deploy and manage serverless applications written in Python 3.12. To migrate existing Lambda functions running earlier Python versions, review your code for compatibility with Python 3.12 and then update the function runtime, or use the AWS-provided Python 3.12 base image to build and deploy Python 3.12 functions using containers. For more information about AWS Lambda, visit our product page