AWS Compute Blog

Announcing migration of the Java 8 runtime in AWS Lambda to Amazon Corretto

April 28, 2021 – Update: Migration from OpenJDK to Corretto has been completed for all functions not using the Java8OpenJDK layer. We have extended the period during which functions using the Java8OpenJDK layer continue to run using OpenJDK rather than Corretto. Customers using this layer should continue to test their functions with Corretto and remove the layer. The schedule for deactivating this layer will be provided in a future update.

August 23, 2021 – Update: We have updated the release phases allowing customers earlier access Amazon Corretto in a subset of AWS Regions.

July 29, 2021 – Update: We have added additional information about Lambda layers available in China and AWS GovCloud (US) partitions.

July 22, 2021 – Update: Based on customer feedback, the migration schedule has been updated to allow customers more time for testing. Please see the updated time table below.


This post is written by Jonathan Tuliani, Principal Product Manager, AWS Lambda.

What is happening?

We are updating the java8 managed runtime in AWS Lambda from the current Open Java Development Kit (OpenJDK) implementation to the latest Amazon Corretto implementation. We encourage you to read through this post to understand the changes and any actions that you might need to take. Note that Lambda supports two versions of the Java 8 managed runtime: the java8 runtime, which runs on Amazon Linux 1, and the java8.al2 runtime, which runs on Amazon Linux 2. This change only affects functions using the java8 runtime.

What are the benefits of upgrading to Amazon Corretto?

Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the OpenJDK that is used by Amazon internally on thousands of production services. Amazon Corretto comes with long-term support that includes performance enhancements and frequent security fixes, and has certified compatibility with the Java SE standard. The Lambda java8.al2 and java11 managed runtimes already use Amazon Corretto, and with this change, we are making Corretto available for the java8 runtime.

What do I need to do?

Amazon Corretto 8 is designed as a drop-in replacement for OpenJDK 8. Most functions benefit seamlessly from the enhancements in this update without any action from you. As a best practice, we encourage you to test this change for compatibility for production workloads. See the following guidance on how to verify compatibility in advance.

When will this happen?

To allow you additional testing time, this migration to Amazon Corretto takes place in several phases:

  • June 15, 2021: Start of testing phase. Availability of Lambda layers for testing the compatibility of functions with the Amazon Corretto runtime.
  • August 23, 2021: Container base image update. The public.ecr.aws/lambda/java:8 container base image is updated to use Amazon Corretto. After this change, any functions built from this image will use Amazon Corretto.
  • August 23, 2021: Create/updates in a subset of Regions. In this phase, Amazon Corretto will be used for new or updated functions in a subset of Regions (eu-west-3, ap-northeast-3, af-south-1, eu-south-1, me-south-1, ap-east-1, eu-north-1, and sa-east-1).
  • August 30, 2021: Create/updates in all Regions: During this phase, use of Amazon Corretto for new or updated functions will be extended to the remaining Regions, China Regions, and AWS GovCloud (US) Regions. This phase is planned to be complete by September 13, 2021.
  • September 20, 2021: All functions in a subset of Regions. In this phase, functions that have not been updated since September 13 will be automatically transitioned to the new Corretto runtime in the subset of Regions as listed above.
  • September 27, 2021: All functions in all Regions: During this phase, use of Amazon Corretto will be extended for all functions in the remaining Regions, China Regions, and AWS GovCloud (US) Regions. This phase is planned to be complete by October 11, 2021.

Note: These changes are only applied to functions not using the Java8Corretto or Java8OpenJDK layers described below. At this point, all functions using the java8 runtime will use Amazon Corretto, unless they have the Java8OpenJDK layer applied.

  • November 5, 2021: Migration completed. The Java8OpenJDK layer will be disabled. Existing functions using this layer will continue to work, but the layer will have no effect. From this date, functions using this layer will run on Amazon Corretto.

Which of my Lambda functions are affected?

The following command shows how to use the AWS CLI to list all functions in a specific Region using the java8 runtime. To find all functions in your account, repeat this command for each AWS Region:

aws lambda list-functions --function-version ALL --region us-east-1 --output text --query "Functions[?Runtime=='java8'].FunctionArn"

How can I test for compatibility with Amazon Corretto 8?

If you are using the java8 managed runtime, you can test functions with the new version of the runtime by adding a layer reference from the following partition table to the function configuration:

Region Layer
AWS Regions arn:aws:lambda:::awslayer:Java8Corretto
China Regions arn:aws-cn:lambda:::awslayer:Java8Corretto
AWS GovCloud (US) arn:aws-us-gov:lambda:::awslayer:Java8Corretto

This layer instructs the Lambda service to use the Amazon Corretto implementation of Java 8. It does not contain any data or code. If you are using container images, update the JVM in your image to Amazon Corretto for testing. Here is an example Dockerfile, which you can use for testing before the public.ecr.aws/lambda/java:8 container base image is updated.

FROM public.ecr.aws/lambda/java:8

# Update the JVM to the latest Corretto version
## Import the Corretto public key
rpm --import https://yum.corretto.aws/corretto.key

## Add the Corretto yum repository to the system list
curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo

## Install the latest version of Corretto 8
yum install -y java-1.8.0-amazon-corretto-devel

# Copy function code and runtime dependencies from Gradle layout
COPY build/classes/java/main ${LAMBDA_TASK_ROOT}
COPY build/dependency/* ${LAMBDA_TASK_ROOT}/lib/

# Set the CMD to your handler
CMD [ "com.example.LambdaHandler::handleRequest" ]

Can I continue to use the OpenJDK version of Java 8?

You can continue to use the OpenJDK version of Java 8 until November 5, 2021. To use OpenJDK, add the appropriate layer reference from the following table to your function configuration:

Region Layer
AWS Regions arn:aws:lambda:::awslayer:Java8OpenJDK
China Regions arn:aws-cn:lambda:::awslayer:Java8OpenJDK
AWS GovCloud (US) arn:aws-us-gov:lambda:::awslayer:Java8OpenJDK

This layer tells the Lambda service to use the OpenJDK implementation of Java 8. It does not contain any data or code.

This option gives you more time to address any code incompatibilities with Amazon Corretto 8. After addressing any compatibility issues, remove this layer reference so that the function uses the Lambda-managed implementation of Java 8. This layer will cease to be effective from November 5, 2021, after which all functions will use Amazon Corretto 8.

What if I need additional help?

Contact AWS Support, the AWS Lambda discussion forums, or your AWS account team if you have any questions or concerns.

For more serverless learning resources, visit Serverless Land.