Skip to content

AWS Lambda Powertools for .NET

AWS Lambda Powertools for .NET (which from here will be referred as Powertools) is a suite of utilities for AWS Lambda functions to ease adopting best practices such as tracing, structured logging, custom metrics, and more. Please note, Powertools is optimized for .NET 6+.

Tip

Powertools is also available for Python, Java, and TypeScript.

Support this project by becoming a reference customer or sharing your work ❤️

You can choose to support us in three ways:

1) Become a reference customers. This gives us permission to list your company in our documentation.

2) Share your work. Blog posts, video, sample projects you used Powertools!

Do not use this library in production

AWS Lambda Powertools for .NET is currently released in preview and is intended strictly for feedback purposes only. This version is not stable, and significant breaking changes might incur as part of the upcoming production-ready release.

Your support is much appreciated. If you encounter any problems, please raise an issue.

Do not use this library for production workloads.

Features

Core utilities such as Tracing, Logging, and Metrics will be available across all Lambda Powertools languages. Additional utilities are subjective to each language ecosystem and customer demand.

Utility Description
Tracing Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
Logger Structured logging made easier, and decorator to enrich structured logging with key Lambda context details
Metrics Custom AWS metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)

Install

Powertools are available as NuGet packages. You can install the packages from NuGet gallery or from Visual Studio editor. Search AWS.Lambda.Powertools* to see various utilities available.

SAM CLI custom template

We have provided you with a custom template for the Serverless Application Model (AWS SAM) command-line interface (CLI). This generates a starter project that allows you to interactively choose the Powertools features that enables you to include in your project.

1
sam init --location https://github.com/aws-samples/cookiecutter-aws-sam-dotnet

To use the SAM CLI, you need the following tools.

Examples

We have provided a few examples that should you how to use the each of the core Powertools features.

Connect

  • AWS Lambda Powertools on Discord: #dotnet - Invite link
  • Email: aws-lambda-powertools-feedback@amazon.com

Tenets

These are our core principles to guide our decision making.

  • AWS Lambda only. We optimize for AWS Lambda function environments and supported runtimes only. Utilities might work with web frameworks and non-Lambda environments, though they are not officially supported.
  • Eases the adoption of best practices. The main priority of the utilities is to facilitate best practices adoption, as defined in the AWS Well-Architected Serverless Lens; all other functionality is optional.
  • Keep it lean. Additional dependencies are carefully considered for security and ease of maintenance, and prevent negatively impacting startup time.
  • We strive for backwards compatibility. New features and changes should keep backwards compatibility. If a breaking change cannot be avoided, the deprecation and migration process should be clearly defined.
  • We work backwards from the community. We aim to strike a balance of what would work best for 80% of customers. Emerging practices are considered and discussed via Requests for Comment (RFCs)
  • Idiomatic. Utilities follow programming language idioms and language-specific best practices.

Last update: 2023-01-04