Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News AWS Lambda Supports Powertools for .NET to Simplify Observability

AWS Lambda Supports Powertools for .NET to Simplify Observability

AWS recently announced that the open-source library Lambda Powertools now supports .NET. The developer library helps implement observability when running Lambda functions based on .NET 6 or above, reducing the amount of custom code.

Providing abstractions on top of the AWS SDK and other managed services, Powertools for .NET helps developers incorporate Well-Architected Serverless observability best practices into .NET Lambda code.

The library includes three core features: Tracing, a distributed tracing to send traces to AWS X-Ray, Logging, a logger to output structured JSON, and Metrics, to capture metrics asynchronously using CloudWatch Embedded Metric Format. Powertools currently supports Lambda functions written in C#, with support for runtime versions .NET 6 and newer.

AWS X-Ray trace service view from

Amir Khairalomoum, senior solutions architect at AWS, shows how to implement observability and manage the deployment using the Serverless Application Model. He writes:

The AWS Lambda Powertools for .NET utilities are available as NuGet packages Each core utility has a separate NuGet package (AWS.Lambda.Powertools.Logging, AWS.Lambda.Powertools.Metrics and AWS.Lambda.Powertools.Tracing). It allows you to add only the packages you need. This helps to make the Lambda package size smaller, which can improve the performance.

For example, the Logging package captures key fields from Lambda context, cold start and structures logging output as JSON. It supports sampling, enabling DEBUG log level for a percentage of requests. To implement structured logging in an application, developers should add the Powertools logging library to the project, and install the packages from the NuGet gallery, the Visual Studio editor, or by using the .NET CLI command:

dotnet add package AWS.Lambda.Powertools.Logging

On Serverless Land, snippets are available to standardize function logs, custom metrics, and tracing with Powertools.

A long-standing request from developers, the new .NET version follows the releases of Powertools for Python, Java, and TypeScript. The Tracing, Logging, and Metrics packages are available across all languages, while additional utilities such as idempotency or batching are subjective to each language and developers' requests. Michael Walmsley, serverless application architect at Accenture, comments:

Why is this important? It enables true polyglot development with consistent outputs in logging which is critical in being able to attain simpler observability. Standardization helps across these tools to enable more teams to collaborate and meet where they are!

The documentation and the source code for Powertools for .NET are available on GitHub.

About the Author

Rate this Article