Maintained with ☕️ by
IcePanel logo

AWS Lambda adds support for Java 21

Share

Services

AWS Lambda now supports creating serverless applications using Java 21\. This runtime is based on the latest long-term support release of [AWS Corretto](https://aws.amazon.com/corretto/), Amazon’s distribution of the Open JDK. Developers can use Java 21 as both a managed runtime and a container base image, and AWS will automatically apply updates to the managed runtime and base image as they become available. The Lambda Java 21 runtime is built on the new [Amazon Linux 2023 runtime](https://aws.amazon.com/blogs/compute/introducing-the-amazon-linux-2023-runtime-for-aws-lambda/), 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. It supports AWS Lambda Snap Start (in supported Regions) for fast cold starts. [Powertools for AWS Lambda (Java)](https://docs.powertools.aws.dev/lambda/java/), a developer toolkit to implement serverless best practices and increase developer velocity, also supports Java 21. The Java 21 runtime is available in all [Regions where Lambda is available](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/), 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 Java 21\. To migrate existing Lambda functions running earlier Java versions, review your code for compatibility with Java 21 and then update the function runtime to Java 21 when redeploying you function. You can also use the [AWS-provided Java 21 base image](https://docs.aws.amazon.com/lambda/latest/dg/java-image.html) to build and deploy Java 21 functions using containers. For more information about AWS Lambda, visit our [product page](https://aws.amazon.com/lambda/).