A .NET deployment package (.zip file archive) contains your function's compiled assembly along with all of its assembly dependencies. The package also contains a
file. This signals to the .NET runtime all of your function's dependencies and aproj
.deps.json
file, which is used to configure the runtime.proj
.runtimeconfig.json
To deploy individual Lambda functions, you can use theAmazon.Lambda.Tools
.NET Lambda Global CLI. Using thedotnet lambda deploy-function
command automatically creates a .zip deployment package and deploys it to Lambda. However, we recommend that you use frameworks like the AWS Serverless Application Model (AWS SAM) or the AWS Cloud Development Kit (AWS CDK) to deploy your .NET applications to AWS.
Serverless applications usually comprise a combination of Lambda functions and other managed AWS services working together to perform a particular business task. AWS SAM and AWS CDK simplify building and deploying Lambda functions with other AWS services at scale. TheAWS SAM template specification provides a simple and clean syntax to describe Lambda functions, APIs, permissions, configurations, and other AWS resources that make up your serverless application. With theAWS CDK you define cloud infrastructure as code to help you build reliable, scalable, cost-effective applications in the cloud using modern programming languages and frameworks like .NET. Both the AWS CDK and the AWS SAM use the .NET Lambda Global CLI to package your functions.
While it's possible to useLambda layers with functions in C# byusing the .NET Core CLI, we recommend against it. Functions in C# that use layers manually load the shared assemblies into memory during theInit phase, which can increase cold start times. Instead, include all shared code at compile time to take advantage of the built-in optimizations of the .NET compiler.
You can find instructions for building and deploying .NET Lambda functions using the AWS SAM, the AWS CDK, and the .NET Lambda Global CLI in the following sections.