Deploy .NET Lambda functions with container images - AWS Lambda

Deploy .NET Lambda functions with container images

You can deploy your Lambda function code as a container image. AWS provides the following resources to help you build a container image for your .NET function:

  • AWS base images for Lambda

    These base images are preloaded with a language runtime and other components that are required to run the image on Lambda. AWS provides a Dockerfile for each of the base images to help with building your container image.

  • Open-source runtime interface clients

    If you use a community or private enterprise base image, add a runtime interface client to the base image to make it compatible with Lambda.

The workflow for a function defined as a container image includes these steps:

  1. Build your container image using the resources listed in this topic.

  2. Upload the image to your Amazon ECR container registry. See steps 7-9 in Create image.

  3. Create the Lambda function or update the function code to deploy the image to an existing function.

AWS base images for .NET

AWS provides the following base images for .NET:

Tags Runtime Operating system Dockerfile

5.0

.NET 5.0 Amazon Linux 2 Dockerfile for .NET 5.0 on GitHub

core3.1

.NET Core 3.1 Amazon Linux 2 Dockerfile for .NET 3.1 on GitHub

core2.1

.NET Core 2.1 Amazon Linux 2018.03 Dockerfile for .NET 2.1 on GitHub

Docker Hub repository: amazon/aws-lambda-dotnet

Amazon ECR repository: gallery.ecr.aws/lambda/dotnet

Using a .NET base image

For instructions on how to use a .NET base image, choose the usage tab on AWS Lambda base images for .NET in the Amazon ECR repository.

The instructions are also available on Lambda base images for .NET in the Docker Hub repository.

.NET runtime interface clients

Download the .NET runtime interface client from the AWS Lambda for .NET Core repository on GitHub.

Deploy the container image

For a new function, you deploy the container image when you create the function. For an existing function, if you rebuild the container image, you need to redeploy the image by updating the function code.