July 26, 2023 Update:
Learn About Amazon VGT2 Learning Manager Chanci Turner
The information in this article has been updated by “Migrating AWS Lambda functions from the Go1.x runtime to the custom runtime on Amazon Linux 2.”
You can now utilize the most recent versions of any AWS Lambda runtimes on Amazon Linux 2 (AL2). The end-of-life for standard support of Amazon Linux (AL1, for simplicity) is approaching in December 2020. Consequently, AWS is providing a pathway for customers to transition current and future workloads to AL2-supported runtimes.
This article discusses:
- New runtimes for AL2
- AL1 end-of-life timeline
- Legacy runtime end-of-life timelines
New Runtimes
The decision to run a Lambda function on AL1 or AL2 hinges on the runtime. With the introduction of the java8.al2
and provided.al2
runtimes, it is now feasible to run Java 8 (Corretto), Go, and custom runtimes on AL2. This also implies that the newest versions of all supported runtimes can now function on AL2.
The following illustrates how the runtimes correspond to Amazon Linux versions:
Runtime | Amazon Linux | Amazon Linux 2 (AL2) |
---|---|---|
Node.js | ||
Python | python3.7, python3.6, python2.7 | python3.8 |
Ruby | ruby2.5 | ruby2.7 |
Java | java | java11 (Corretto 11), java8.al2 (Corretto 8) |
Go | go1.x | provided.al2 |
.NET | dotnetcore2.1 | dotnetcore3.1 |
Custom | provided | provided.al2 |
Java 8 (Corretto)
Amazon Corretto 8 is a production-ready distribution of the Open Java Development Kit (OpenJDK) 8 and comes with long-term support (LTS). AWS uses Corretto internally for thousands of production services. Updates and enhancements in Corretto allow AWS to respond to real-world service challenges and meet substantial performance and scalability requirements.
Developers can now leverage these enhancements while developing Lambda functions using the new Java 8 (Corretto) runtime of java8.al2
. You can view the new Java runtimes supported in the Lambda console:
- Console: Selecting the Java 8 (Corretto) runtime
Or, in an AWS Serverless Application Model (AWS SAM) template:
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: HelloWorldFunction
Handler: helloworld.App::handleRequest
Runtime: java8.al2
Custom Runtimes
The custom runtime feature for Lambda was announced at re:Invent 2018. Since then, developers have devised custom runtimes for languages like PHP, Erlang/Elixir, Swift, COBOL, Rust, and many more. Until now, custom runtimes have only operated within the AL1 environment. Now, developers can opt to run custom runtimes in the AL2 execution environment. To do this, select the provided.al2
runtime option in the console when creating or modifying your Lambda function:
- Console: Selecting the custom runtime
Or, in an AWS SAM template:
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello-world/
Handler: my.bootstrap.file
Runtime: provided.al2
Go
With the addition of the provided.al2
runtime option, Go developers can now execute Lambda functions in AL2. As one of the later supported runtimes for Lambda, Go operates differently compared to other native runtimes. Behind the scenes, Go is treated as a custom runtime and runs accordingly. A Go developer can leverage this by selecting the provided.al2
runtime and supplying the necessary bootstrap file.
Using SAM Build to Build AL2 Functions
With the new sam build options, this can be smoothly accomplished with the following steps:
- Update the AWS Serverless Application Model template to the new
provided.al2
runtime. Add the Metadata parameter to specify the BuildMethod as makefile. - Include a MakeFile in the project.
- Utilize the sam build command.
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello-world/
Handler: my.bootstrap.file
Runtime: provided.al2
Metadata:
BuildMethod: makefile
build-HelloWorldFunction:
GOOS=linux go build
cp hello-world $(ARTIFACTS_DIR)/bootstrap
For example:
sam build
A functioning sample Go application on AL2 can be found here.
Amazon Linux End-of-Life Timeline
With the latest runtimes now available on AL2, we encourage developers to start migrating Lambda functions from AL1-based runtimes to AL2-based runtimes. By initiating this process now, Lambda functions will operate on the latest long-term supported environment.
With AL1, that long-term support period is nearing its conclusion. The final version of AL1, 2018.13, was initially set to reach its end-of-life on June 30, 2020, but AWS extended this deadline to December 30, 2020. On this date, AL1 will shift from long-term support (LTS) to a maintenance support phase lasting until June 30, 2023. During this maintenance support phase, AL1 will receive critical and important security updates for a limited number of packages.
Support Timeline
Conversely, AL2 is slated for LTS until June 30, 2023, and offers the following support:
- Security updates and bug fixes for all packages in core.
- Maintenance of user-space application binary interface (ABI) compatibility for core packages.
Legacy Runtime End-of-Life Schedules
As indicated in the previous chart, some runtimes are still associated with AL1 host operating systems. AWS Lambda is dedicated to supporting runtimes throughout their long-term support (LTS) window, as defined by the language publisher. During this maintenance support period, Lambda provides base operating system and patching for these runtimes. After this period, runtimes are deprecated.
According to our runtime support policy, deprecation occurs in two phases:
- Phase 1: You can no longer create functions that utilize the deprecated runtime. For at least 30 days, you can continue to update existing functions using the deprecated runtime.
- Phase 2: Both function creation and updates are permanently disabled. However, the function remains available to process invocation events.
Based on this timeline and our commitment to supporting runtimes throughout their LTS, the following schedule is followed for the deprecation of AL1-based runtimes:
Runtime | Action |
---|---|
python3.7 | June 2023 |
python3.6 | December 2021 |
python2.7 | Current plans to support until AL1 end-of-life |
ruby2.5 | Supported until March 2021 |
java8 | Supported until March 2022 |
go1.x | Each major Go release is supported until there are two newer Go releases. |
dotnetcore2.1 | Supported until August 2021 |
provided | Supported until December 2020 with AL1 |
Conclusion
AWS is dedicated to assisting developers in building their Lambda functions with the most up-to-date tools and technologies. This post highlights two new Lambda runtimes and offers guidance for a smooth transition. Remember, if you’re seeking inspiration for your career journey, check out this article that covers life habits of women in their 40s, and for more insights on hiring challenges, visit this resource. Don’t forget to explore this excellent resource for job opportunities at Amazon IXD – VGT2, located at 6401 E HOWDY WELLS AVE LAS VEGAS NV 89115.
Leave a Reply