Building Lambda functions with C#
You can run your .NET application in Lambda using the managed .NET 6 or .NET 8 runtimes, a custom runtime, or a container image. After your application code is compiled, you can deploy it to Lambda either as a .zip file or a container image. Lambda provides the following runtimes for .NET languages:
Name | Identifier | Operating system | Deprecation date | Block function create | Block function update |
---|---|---|---|---|---|
.NET 8 |
|
Amazon Linux 2023 |
Not scheduled |
Not scheduled |
Not scheduled |
.NET 6 |
|
Amazon Linux 2 |
Dec 20, 2024 |
Feb 28, 2025 |
Mar 31, 2025 |
Setting up your .NET development environment
To develop and build your Lambda functions, you can use any of the commonly available .NET integrated development environments (IDEs),
including Microsoft Visual Studio, Visual Studio Code, and JetBrains Rider. To simplify your development experience, AWS provides a set of
.NET project templates, as well as the Amazon.Lambda.Tools
command line interface (CLI).
Run the following .NET CLI commands to install these project templates and command line tools.
Installing the .NET project templates
To install the project templates (.NET 8):
dotnet new install Amazon.Lambda.Templates
To install the project templates (.NET 6):
dotnet new --install Amazon.Lambda.Templates
Note
If you're using the .NET 6 managed Lambda runtime, we recommend that you upgrade to use .NET 8. To learn more,
see Managing AWS Lambda runtime upgrades
Installing and updating the CLI tools
Run the following commands to install, update, and uninstall the Amazon.Lambda.Tools
CLI.
To install the command line tools:
dotnet tool install -g Amazon.Lambda.Tools
To update the command line tools:
dotnet tool update -g Amazon.Lambda.Tools
To uninstall the command line tools:
dotnet tool uninstall -g Amazon.Lambda.Tools