VOOZH about

URL: https://www.nuget.org/packages/Amazon.Lambda.RuntimeSupport/

⇱ NuGet Gallery | Amazon.Lambda.RuntimeSupport 2.1.1




👁 Image
Amazon.Lambda.RuntimeSupport 2.1.1

Prefix Reserved
dotnet add package Amazon.Lambda.RuntimeSupport --version 2.1.1
 
 
NuGet\Install-Package Amazon.Lambda.RuntimeSupport -Version 2.1.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="2.1.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="2.1.1" />
 
Directory.Packages.props
<PackageReference Include="Amazon.Lambda.RuntimeSupport" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Amazon.Lambda.RuntimeSupport --version 2.1.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Amazon.Lambda.RuntimeSupport, 2.1.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Amazon.Lambda.RuntimeSupport@2.1.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Amazon.Lambda.RuntimeSupport&version=2.1.1
 
Install as a Cake Addin
#tool nuget:?package=Amazon.Lambda.RuntimeSupport&version=2.1.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Amazon.Lambda.RuntimeSupport

The Amazon.Lambda.RuntimeSupport package is a .NET Lambda Runtime Interface Client (RIC) for the Lambda Runtime API. The Lambda Runtime Interface Client allows your runtime to receive requests from and send requests to the Lambda service. It can be used for building .NET Lambda functions as either custom runtimes or container images. Starting with the .NET 6 this is also the Lambda rutime client used in managed runtimes.

Container Image support

AWS provides base images containing all the required components to run your functions packaged as container images on AWS Lambda. Starting with the AWS Lambda .NET 5 base image Amazon.Lambda.RuntimeSupport is used as the Lambda Runtime Client. The library targets .NET Standard 2.0 and can also be used in earlier versions of .NET Core that support .NET Standard like 3.1.

In the AWS Lambda .NET base image this library is preinstalled into /var/runtime directory. .NET Lambda functions using the base image do not directly interact with this package. Instead they pass in an image command or a Dockerfile CMD that indicates the .NET code to run. The format of that parameter is <assembly-name>::<full-type-name>::<function-name>.

Custom base container images where Amazon.Lambda.RuntimeSupport is not preinstalled the library can be included in the .NET Lambda function code as a class library. To learn how to build a .NET Lambda function using Amazon.Lambda.RuntimeSupport as a class library checkout the Using Amazon.Lambda.RuntimeSupport as a class library section in this README.

The Dockefile below shows how to build a Lambda function using a custom base image. In this case the base image is Microsoft's .NET 6 runtime image. This Dockerfile copies the .NET Lambda function into the /var/task directory and then uses the dotnet CLI to execute the .NET Lambda project which will initialize the Amazon.Lambda.RuntimeSupport library and start responding to Lambda events.

FROM mcr.microsoft.com/dotnet/runtime:6.0

WORKDIR /var/task

COPY "bin/Release/net6.0/linux-x64/publish" .

ENTRYPOINT ["/usr/bin/dotnet", "exec", "/var/task/LambdaContainerCustomBase.dll"]

Using Amazon.Lambda.RuntimeSupport as a class library

Amazon.Lambda.RuntimeSupport can be used as a class library to interact with the Lambda Runtime API. This is done by adding the NuGet dependency to Amazon.Lambda.RuntimeSupport and adding a Main function to Lambda .NET project to initialize Amazon.Lambda.RuntimeSupport library. The class handles initialization of the function and runs the loop that receives and handles invocations from the AWS Lambda service. Take a look at the signature of the ToUpperAsync method in the example below. This signature is the default for function handlers when using the Amazon.Lambda.RuntimeSupport.LambdaBootstrap class.

private static MemoryStream ResponseStream = new MemoryStream();
private static JsonSerializer JsonSerializer = new JsonSerializer();

private static async Task Main(string[] args)
{
 using(var bootstrap = new LambdaBootstrap(ToUpperAsync))
 {
 await bootstrap.RunAsync();
 }
}

private static Task<InvocationResponse> ToUpperAsync(InvocationRequest invocation)
{
 var input = JsonSerializer.Deserialize<string>(invocation.InputStream);

 ResponseStream.SetLength(0);
 JsonSerializer.Serialize(input.ToUpper(), ResponseStream);
 ResponseStream.Position = 0;

 return Task.FromResult(new InvocationResponse(responseStream, false));
}

The class allows you to use existing handlers with LambdaBootstrap. The Amazon.Lambda.RuntimeSupport.HandlerWrapper class also takes care of deserialization and serialization for you.

private static async Task Main(string[] args)
{
 using(var handlerWrapper = HandlerWrapper.GetHandlerWrapper((Func<string, ILambdaContext, string>)ToUpper, new JsonSerializer()))
 using(var bootstrap = new LambdaBootstrap(handlerWrapper))
 {
 await bootstrap.RunAsync();
 }
}

// existing handler doesn't conform to the new Amazon.Lambda.RuntimeSupport default signature
public static string ToUpper(string input, ILambdaContext context)
{
 return input?.ToUpper();
}

The class handles interaction with the AWS Lambda Runtime Interface. This class is meant for advanced use cases. Under most circumstances you won't use it directly.

Below is an excerpt from the class that demonstrates how Amazon.Lambda.RuntimeSupport.RuntimeApiClient is used. Read the full source for Amazon.Lambda.RuntimeSupport.LambdaBootstrap to learn more.

internal async Task InvokeOnceAsync()
{
 using (var invocation = await Client.GetNextInvocationAsync())
 {
 InvocationResponse response = null;
 bool invokeSucceeded = false;

 try
 {
 response = await _handler(invocation);
 invokeSucceeded = true;
 }
 catch (Exception exception)
 {
 await Client.ReportInvocationErrorAsync(invocation.LambdaContext.AwsRequestId, exception);
 }

 if (invokeSucceeded)
 {
 try
 {
 await Client.SendResponseAsync(invocation.LambdaContext.AwsRequestId, response?.OutputStream);
 }
 finally
 {
 if (response != null && response.DisposeOutputStream)
 {
 response.OutputStream?.Dispose();
 }
 }
 }
 }
}
Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (29)

Showing the top 5 NuGet packages that depend on Amazon.Lambda.RuntimeSupport:

Package Downloads
Amazon.Lambda.AspNetCoreServer.Hosting

Package for running ASP.NET Core applications using the Minimal API style as a AWS Lambda function.

Lambdajection.Runtime

Sets Lambdajection projects up to support custom runtimes.

Stackage.Aws.Lambda

Custom runtime for .NET console bootstrap

Abbotware.Interop.Aws.Lambda

Abbotware Interop Library for Aws Lambda - Contains helper methods, extension methods, and plugins

AlexaVoxCraft.MediatR.Lambda

Lambda hosting and middleware integration for Alexa skills using MediatR and AlexaVoxCraft.

GitHub repositories (9)

Showing the top 9 popular GitHub repositories that depend on Amazon.Lambda.RuntimeSupport:

Repository Stars
DataDog/dd-trace-dotnet
.NET Client Library for Datadog APM
aws/aws-extensions-for-dotnet-cli
Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Elfocrash/aws-videos
aws-powertools/powertools-lambda-dotnet
Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity.
aws-samples/serverless-dotnet-demo
aws/integrations-on-dotnet-aspire-for-aws
This repositry contains the integrations with .NET Aspire for AWS.
awslabs/dotnet-nativeaot-labs
A place to learn about and experiment with .NET NativeAOT on AWS.
newrelic/newrelic-dotnet-agent
The New Relic .NET language agent.
LambdaSharp/LambdaSharpTool
Serverless .NET on AWS - λ# is a CLI and Framework for Rapid Application Development using .NET on AWS
Version Downloads Last Updated
2.1.1 36,327 5/29/2026
2.1.0 81,178 5/18/2026
2.0.0 57,974 5/7/2026
1.14.3 159,512 4/16/2026
1.14.2 742,001 2/4/2026
1.14.1 737,745 11/19/2025
1.14.0 49,993 11/6/2025
1.13.4 226,942 9/18/2025
1.13.3 13,535 9/16/2025
1.13.2 299,814 8/26/2025
1.13.1 1,964,960 6/3/2025
1.13.0 961,437 3/14/2025
1.12.3 677,364 2/25/2025
1.12.2 609,066 12/10/2024
1.12.1 914,610 11/26/2024
1.12.0 561,741 11/18/2024
1.11.0 1,503,761 9/5/2024
1.10.0 4,403,765 10/26/2023
1.9.1 28,738 10/23/2023
1.9.0 22,365 10/13/2023
Loading failed