How to use AL2023 in a NET 6 Lambda function?

150 views Asked by At

I have a few Lambda functions set up to use NET 6.

The lambdas are created through serverless templates and have the property:

"Runtime": "dotnet6"

NET 6 Lambda function

By default they use Amazon Linux 2, but I want to update them to Amazon Linux 2023. I've been trying to follow this documentation without success:

AWS documentation for AL2023

The docs say that the Runtime should be changed to "provided.al2023" but that messes with specifying using NET 6 for the function.

If anyone has tried using NET 6 and AL2023, I would really appreciate if they could share their experiences.

Thank you!

1

There are 1 answers

0
Ankush Jain On BEST ANSWER

AWS provides managed runtime for .NET6 Lambda functions, but the runtime still uses Amazon Linux 2 as the base image. With .NET 8, however, AWS will use Amazon Linux 3 as the base image in its managed runtime.

The future releases of managed language runtimes such as Node.js 20, Python 3.12, Java 21, and .NET 8 are based on Amazon Linux 2023 and will use provided.al2023 as the base image.

As per the documentation, target launch month for upcoming Lambda runtimes for .NET 8 is January 2024.

Now coming to your question, you have 2 options:

  1. For the time being, deploy .NET6 Lambda functions on AWS managed runtime that leverages Amazon Linux 2, and when .NET8 managed runtime is released, just upgrade your .NET6 Lambda functions to .NET8.
  2. Use Custom Runtime to run your .NET Lambda function. Here, I have written a blog-post to show how to do that - Running .NET 8 Lambda Functions on AWS using Custom Runtime