Skip to content

Latest commit

 

History

History
executable file
·
60 lines (36 loc) · 3.91 KB

csharp-image.md

File metadata and controls

executable file
·
60 lines (36 loc) · 3.91 KB

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.

    AWS provides base images for the x86_64 architecture for all supported .NET runtimes, and for the arm64 architecture for the .NET Core 3.1 and .NET 6.0 runtimes.

  • Open-source runtime interface clients (RIC)

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

  • Open-source runtime interface emulator (RIE)

    Lambda provides a runtime interface emulator for you to test your function locally. The base images for Lambda and base images for custom runtimes include the RIE. For other base images, you can download the RIE for testing your image locally.

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.

Topics

AWS base images for .NET

AWS provides the following base images for .NET:

Tags Runtime Operating system Dockerfile
6 .NET 6.0 Amazon Linux 2 Dockerfile for .NET 6.0 on GitHub
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.