Powertools for AWS Lambda (.NET)
Powertools for AWS Lambda (.NET) is a developer toolkit to implement Serverless best practices and increase developer velocity.
Join us on the AWS Developers Slack at
#lambda-powertools
- Invite, if you don't have an account
Features
Powertools for AWS Lambda (.NET) provides three core utilities:
-
Logging - provides a custom logger class that outputs structured JSON. It allows you to pass in strings or more complex objects, and will take care of serializing the log output. Common use cases—such as logging the Lambda event payload and capturing cold start information—are handled for you, including appending custom keys to the logger at anytime.
-
Metrics - makes collecting custom metrics from your application simple, without the need to make synchronous requests to external systems. This functionality is powered by Amazon CloudWatch Embedded Metric Format (EMF), which allows for capturing metrics asynchronously.
-
Tracing - provides a simple way to send traces from functions to AWS X-Ray to provide visibility into function calls, interactions with other AWS services, or external HTTP requests. Annotations can easily be added to traces to allow filtering traces based on key information. For example, when using Tracer, a ColdStart annotation is created for you so you can easily group and analyze traces where there was an initialization overhead.
-
Parameters (developer preview) - provides high-level functionality to retrieve one or multiple parameter values from AWS Systems Manager Parameter Store{target="_blank"}, AWS Secrets Manager{target="_blank"}, or Amazon DynamoDB{target="_blank"}. We also provide extensibility to bring your own providers.
Installation
The Powertools for AWS Lambda (.NET) utilities (.NET 6) are available as NuGet packages. You can install the packages from NuGet Gallery{target="_blank"} or from Visual Studio editor by searching AWS.Lambda.Powertools*
to see various utilities available.
-
AWS.Lambda.Powertools.Logging:
dotnet add package AWS.Lambda.Powertools.Logging
-
AWS.Lambda.Powertools.Metrics:
dotnet add package AWS.Lambda.Powertools.Metrics
-
AWS.Lambda.Powertools.Tracing:
dotnet add package AWS.Lambda.Powertools.Tracing
-
AWS.Lambda.Powertools.Parameters:
dotnet add package AWS.Lambda.Powertools.AWS.Lambda.Powertools.Parameters
Examples
We have provided examples focused specifically on each of the utilities. Each solution comes with an AWS Serverless Application Model (AWS SAM) templates to run your functions as a Zip package using the AWS Lambda .NET 6 managed runtime; or as a container package using the AWS base images for .NET.
Other members of the Powertools for AWS Lambda family
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)
Credits
- Structured logging initial implementation from aws-lambda-logging
- Powertools for AWS Lambda (.NET) idea DAZN Powertools
đź‘‹ Contributing
We welcome contributions from developers of all levels to our open-source project on GitHub. If you'd like to contribute, please check our contributing guidelines and help make this project more accessible.
Connect
- Powertools for AWS Lambda on Discord:
#dotnet
- Invite link - Email: aws-lambda-powertools-feedback@amazon.com
License
This project is licensed under the Apache-2.0 License.