AWS recently announced that Lambda supports Python 3.10 as both a managed runtime and container base image, allowing developers to leverage the improvements and features of the runtime.
AWS Lambda is a serverless computing service that allows developers to run code in the cloud without managing servers, providing automatic scaling and high availability. In addition, it supports several runtimes such as Python, Node, and .NET. The service now supports Python version 3.10, which includes structural pattern matching, improved error messages, and performance enhancements.
In an AWS Compute blog post, Suresh Poopandi, a senior solutions architect at AWS, mentions that structural pattern matching is one of the most significant additions to Python 3.10:
With structural pattern matching, developers can use patterns to match against data structures such as lists, tuples, and dictionaries and run code based on the match. This feature enables developers to write code that processes complex data structures more easily and can improve code readability and maintainability.
In addition, improved error messages provide developers with more information about the source of the error and suggest possible solutions, which helps identify and fix issues more quickly.
The support for Python 3.10 in Lambda comes a year and a half after the release of candidate one. After this release, support was requested for Lambda in Github base images. However, it took some time. One of the respondents in the request stated:
As a customer, it’s worrying that it’s taking AWS more than 12 months to update a system that has a fixed 12-month upgrade cycle. If AWS continues the way they have for Python 3.9 and 3.10, Lambda is going to fall further and further behind on Python versions continually.
In addition, Michael Brewer, a VP architect fellow platform engineering at Fiserv, tweeted:
Let’s hope 3.11 comes out shortly and is faster than 3.9. AWS lambda python 3.10 seems like a skip due to performance regression.
Yet the company has already published a preview Lambda container base image for Python 3.11, which is subject to change and should not be used for production workloads.
Corey Quinn, chief cloud economist at DuckbillGroup, concluded in a blog post:
AWS’s major competitors all support Python 3.10 at a minimum. It’s long past time for AWS to either ship the language runtime customers are (quite reasonably!) clamoring for or else offer up better transparency than the "we’re working on it" stonewalling that we’ve gotten for over a year.
Developers can build and deploy functions using Python 3.10 using the AWS Management Console, AWS CLI, AWS SDK, AWS SAM, AWS CDK, or alternative Infrastructure as Code (IaC) choices. In addition, they can also use the Python 3.10 container base image if they prefer to build and deploy their functions using container images.
Lastly, more details on building Lambda functions with Python are available on the documentation pages.