Powertools for AWS Lambda (.NET) is a developer toolkit to implement Serverless best practices and increase developer velocity.
Also available in Python, TypeScript, and Java.
π Documentation | NuGet | Roadmap | Examples
Core utilities:
-
Logging - structured JSON logging with Lambda context, cold start, correlation IDs, custom keys and optional event logging. Works with
ILogger, ASP.NET Core and Native AOT. -
Metrics - custom metrics written asynchronously with CloudWatch Embedded Metric Format (EMF), with no synchronous calls to CloudWatch.
AWS.Lambda.Powertools.Metrics.AspNetCoreadds middleware and endpoint filters for ASP.NET Core. -
Tracing - AWS X-Ray tracing for your handler, AWS SDK calls and outbound HTTP requests, with a
ColdStartannotation added for you and support for custom annotations and metadata.
Event handlers:
-
AppSync Events - route AWS AppSync Events publish and subscribe operations to handlers by channel path, with support for wildcards and aggregated processing.
-
Bedrock Agent Functions - register tools for Amazon Bedrock Agents and let the resolver handle parameter binding and response formatting. Also available for ASP.NET Core.
Utilities:
-
Parameters - retrieve and cache values from AWS Systems Manager Parameter Store, AWS Secrets Manager, AWS AppConfig or Amazon DynamoDB, or bring your own provider.
-
Idempotency - make Lambda functions safe to retry by storing results in Amazon DynamoDB and returning them for repeated events.
-
Batch Processing - handle partial failures when processing batches from Amazon SQS, Amazon Kinesis Data Streams and Amazon DynamoDB Streams.
-
Kafka Consumer - deserialize Avro, Protobuf and JSON keys and values from Amazon MSK and self-managed Apache Kafka events, with Schema Registry support.
-
JMESPath Functions - extract data from event payloads with JMESPath, including built-in functions to decode JSON strings, base64 and compressed data.
-
Lambda Metadata - read execution environment metadata, such as the Availability Zone ID, from the Lambda Metadata Endpoint, cached for the lifetime of the execution environment.
The utilities are published as separate NuGet packages, so you only install what you use. Browse them on the NuGet Gallery or install with dotnet add package:
| Utility | Package |
|---|---|
| Logging | AWS.Lambda.Powertools.Logging |
| Metrics | AWS.Lambda.Powertools.Metrics |
| Metrics for ASP.NET Core | AWS.Lambda.Powertools.Metrics.AspNetCore |
| Tracing | AWS.Lambda.Powertools.Tracing |
| AppSync Events | AWS.Lambda.Powertools.EventHandler |
| Bedrock Agent Functions | AWS.Lambda.Powertools.EventHandler.Resolvers.BedrockAgentFunction |
| Bedrock Agent Functions for ASP.NET Core | AWS.Lambda.Powertools.EventHandler.Resolvers.BedrockAgentFunction.AspNetCore |
| Parameters | AWS.Lambda.Powertools.Parameters |
| Idempotency | AWS.Lambda.Powertools.Idempotency |
| Batch Processing | AWS.Lambda.Powertools.BatchProcessing |
| Kafka Consumer (Avro) | AWS.Lambda.Powertools.Kafka.Avro |
| Kafka Consumer (Protobuf) | AWS.Lambda.Powertools.Kafka.Protobuf |
| Kafka Consumer (JSON) | AWS.Lambda.Powertools.Kafka.Json |
| JMESPath Functions | AWS.Lambda.Powertools.JMESPath |
| Lambda Metadata | AWS.Lambda.Powertools.Metadata |
For example:
dotnet add package AWS.Lambda.Powertools.LoggingEach utility's documentation includes code examples. They're kept in docs/snippets and compiled against the libraries on every change.
Not using .NET? No problem, we have you covered. Here are the other members of the Powertools for AWS Lambda family:
- Powertools for AWS Lambda (Python)
- Powertools for AWS Lambda (Java)
- Powertools for AWS Lambda (TypeScript)
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (.NET), you can request to have your name and logo added to the README file by raising a Support Powertools for AWS Lambda (.NET) (become a reference) issue.
The following companies, among others, use Powertools:
Share what you built with Powertools for AWS Lambda (.NET): blog posts, workshops, talks, sample apps and more. See what the community has already shared on the We Made This page.
We welcome contributions from developers of all levels. Read the contributing guidelines to get started, and look for issues labelled good first issue or help wanted.
- Structured logging initial implementation from aws-lambda-logging
- Powertools for AWS Lambda (.NET) idea DAZN Powertools
- Powertools for AWS Lambda on Discord:
#dotnet- Invite link - Email: aws-lambda-powertools-feedback@amazon.com
If you think you've found a potential security issue, please do not post it in the Issues. Instead, please follow the AWS vulnerability reporting instructions or email AWS security directly.
This project is licensed under the Apache-2.0 License.