AwsLambda.Host.Abstractions
1.0.0-beta.2
See the version list below for details.
dotnet add package AwsLambda.Host.Abstractions --version 1.0.0-beta.2
NuGet\Install-Package AwsLambda.Host.Abstractions -Version 1.0.0-beta.2
<PackageReference Include="AwsLambda.Host.Abstractions" Version="1.0.0-beta.2" />
<PackageVersion Include="AwsLambda.Host.Abstractions" Version="1.0.0-beta.2" />
<PackageReference Include="AwsLambda.Host.Abstractions" />
paket add AwsLambda.Host.Abstractions --version 1.0.0-beta.2
#r "nuget: AwsLambda.Host.Abstractions, 1.0.0-beta.2"
#:package AwsLambda.Host.Abstractions@1.0.0-beta.2
#addin nuget:?package=AwsLambda.Host.Abstractions&version=1.0.0-beta.2&prerelease
#tool nuget:?package=AwsLambda.Host.Abstractions&version=1.0.0-beta.2&prerelease
AwsLambda.Host.Abstractions
Core interfaces and abstractions for the aws-lambda-host framework.
⚠️ Development Status: This project is actively under development and not yet production-ready. Breaking changes may occur in future versions. Use at your own discretion in production environments.
Overview
Core interfaces and delegates that define the AwsLambda.Host framework contract. This package provides:
- Handler Abstractions: Interfaces for Lambda request and response handling across different event types
- Envelope Abstractions: Contracts for extracting request payloads and packing response payloads
- Middleware Contracts: Abstractions for building and composing middleware components
- Dependency Injection: Service container and lifetime management interfaces
- Extension Points: Contracts for custom integrations and framework extensions
This package is typically used implicitly by AwsLambda.Host, but is essential if you're building custom integrations, middleware components, or extensions to the framework.
Packages
The framework is divided into focused packages:
| Package | NuGet | Downloads |
|---|---|---|
| AwsLambda.Host | ||
| AwsLambda.Host.Abstractions | ||
| AwsLambda.Host.OpenTelemetry |
Installation
Install via NuGet:
dotnet add package AwsLambda.Host.Abstractions
Or specify a version:
dotnet add package AwsLambda.Host.Abstractions --version <version>
Ensure your project uses C# 11 or later:
<PropertyGroup>
<LangVersion>11</LangVersion>
</PropertyGroup>
Note: This package is typically included automatically when you use AwsLambda.Host. Direct installation is only necessary when building custom integrations or extensions.
Core Abstractions
ILambdaApplication
The main builder interface for configuring a Lambda application using a fluent pattern:
MapHandler()– Register the Lambda invocation handlerUse()– Add middleware to the pipelineOnInit()– Register initialization handlersOnShutdown()– Register shutdown handlers
See AwsLambda.Host for usage examples.
ILambdaHostContext
Encapsulates a single Lambda invocation:
Event– The deserialized Lambda eventResponse– The handler's response to returnServiceProvider– Access to the scoped DI containerItems– Key/value collection for invocation-scoped dataCancellationToken– Cancellation signal from Lambda timeout
ILambdaCancellationTokenSourceFactory
Provides a factory for creating cancellation token sources configured for AWS Lambda invocations:
NewCancellationTokenSource(ILambdaContext)– Creates aCancellationTokenSourcethat cancels before the Lambda function timeout, allowing time for graceful shutdown
This interface enables custom implementations for managing cancellation tokens with respect to Lambda's remaining execution time. The default implementation applies a configurable buffer duration to ensure operations complete before the Lambda runtime's hard timeout.
Envelope Abstractions
IRequestEnvelope
Defines a contract for extracting and deserializing incoming Lambda event payloads. Implementations extract the inner payload from the outer Lambda event structure and deserialize it for handler processing.
IResponseEnvelope
Defines a contract for serializing and packing handler results into Lambda response structures. Implementations serialize the handler result and place it in the appropriate location within the outer response structure.
These abstractions enable strongly-typed handling of AWS Lambda events (like API Gateway, SQS) with automatic payload extraction and response packing. See the envelope packages for concrete implementations.
Handler Delegates
LambdaInvocationDelegate
Task LambdaInvocationDelegate(ILambdaHostContext context)
Processes a Lambda invocation.
LambdaInitDelegate
Task<bool> LambdaInitDelegate(IServiceProvider services, CancellationToken cancellationToken)
Runs once during initialization. Return true to continue, false to abort.
LambdaShutdownDelegate
Task LambdaShutdownDelegate(IServiceProvider services, CancellationToken cancellationToken)
Runs once during shutdown for cleanup.
Lambda Lifecycle
The abstractions represent three Lambda execution phases:
- Init –
LambdaInitDelegateruns once during function initialization - Invocation –
LambdaInvocationDelegateruns for each event - Shutdown –
LambdaShutdownDelegateruns once before termination
For implementation details and examples, see AwsLambda.Host.
Related Packages
- AwsLambda.Host – Core Lambda framework with middleware and DI
- AwsLambda.Host.OpenTelemetry – OpenTelemetry integration for distributed tracing
- Root README – Project overview and examples
Documentation
- Full Project Documentation – Comprehensive guides and patterns
- Examples – Sample Lambda functions demonstrating framework patterns
Contributing
Contributions are welcome! Please check the GitHub repository for contribution guidelines.
License
This project is licensed under the MIT License. See LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Amazon.Lambda.Core (>= 2.7.1)
-
net8.0
- Amazon.Lambda.Core (>= 2.7.1)
-
net9.0
- Amazon.Lambda.Core (>= 2.7.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on AwsLambda.Host.Abstractions:
| Package | Downloads |
|---|---|
|
AwsLambda.Host
.NET Host for AWS Lambda |
|
|
AwsLambda.Host.OpenTelemetry
OpenTelemetry for .NET Host for AWS Lambda |
|
|
AwsLambda.Host.Envelopes.Sqs
Strongly-typed SQS Models AWS Lambda |
|
|
AwsLambda.Host.Envelopes.ApiGateway
Strongly-typed API Gateway Models AWS Lambda |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1-beta.1 | 0 | 11/24/2025 |
| 1.0.0-beta.3 | 0 | 11/24/2025 |
| 1.0.0-beta.2 | 91 | 11/15/2025 |
| 1.0.0-beta.1 | 87 | 11/15/2025 |
| 0.1.3 | 196 | 11/10/2025 |
| 0.1.2 | 179 | 11/10/2025 |
| 0.0.7-alpha.3 | 144 | 11/9/2025 |
| 0.0.7-alpha.2 | 78 | 11/9/2025 |
| 0.0.7-alpha.1 | 79 | 11/9/2025 |
| 0.0.6-alpha.1 | 136 | 11/6/2025 |
| 0.0.5-alpha.1 | 128 | 11/6/2025 |
| 0.0.4-alpha.3 | 134 | 11/2/2025 |
| 0.0.4-alpha.2 | 134 | 11/2/2025 |
| 0.0.4-alpha.1 | 136 | 11/2/2025 |
| 0.0.3-alpha.1 | 59 | 11/1/2025 |
| 0.0.2-alpha.10 | 136 | 10/30/2025 |
| 0.0.2-alpha.9 | 131 | 10/30/2025 |
| 0.0.2-alpha.8 | 134 | 10/30/2025 |
| 0.0.2-alpha.7 | 132 | 10/30/2025 |
| 0.0.2-alpha.6 | 124 | 10/30/2025 |
| 0.0.2-alpha.5 | 129 | 10/30/2025 |
| 0.0.2-alpha.3 | 124 | 10/30/2025 |
| 0.0.2-alpha.2 | 131 | 10/30/2025 |
| 0.0.2-alpha.1 | 135 | 10/29/2025 |
| 0.0.1-alpha.7 | 116 | 10/26/2025 |
| 0.0.1-alpha.6 | 112 | 10/26/2025 |