Releases: aws-powertools/powertools-lambda-dotnet
1.8.1
Summary
In this release we are happy to introduce two new converters for DateOnly and TimeOnly types. These are not supported by default on .NET 6 but will be included in Powertools.
We also fixed two bugs reported on the metrics utility.
- Do not throw exception when decorating a non Lambda handler method
- Do not throw exception when Metadata uses and existing metrics key
- Do not throw exception on second invocation when using Metadata
Version updates
Changes
🌟New features and non-breaking changes
🐛 Bug and hot fixes
- fix: Metrics throws exception when using AddMetadata (#505) by @hjgraca
- fix: Metrics throws exception when decorating non handler methods (#499) by @hjgraca
🔧 Maintenance
- chore: Update projects readme for nuget (#495) by @hjgraca
- chore: Update Batch Processing examples. Update all dependencies (#493) by @hjgraca
This release was made possible by the following contributors:
1.8.0
Summary
In this release we are happy to announce the first developer preview for the new Batch Processing utility 🚀. The batch processing utility handles partial failures when processing batches from Amazon SQS, Amazon Kinesis Data Streams, and Amazon DynamoDB Streams.
Check the documentation for how to get started with Batch Processing utility.
This utility is currently in developer preview and is intended strictly for feedback and testing purposes and not for production workloads. The version and all future versions tagged with the -preview suffix should be treated as not stable. Until this utility is General Availability we may introduce significant breaking changes and improvements in response to customers feedback.
🌟Key features
- Reports batch item failures to reduce number of retries for a record upon errors
- Simple interface to process each batch record
- Bring your own batch processor
- Parallel processing
Implementation examples
Amazon SQS processor

Amazon Kinesis Data Streams processor

Amazon DynamoDB Streams processor

This release was made possible by the following contributors:
@lachriz-aws, @hjgraca, and @amirkaws
Release 1.7.1
Summary
In this release we fix a bug that was introduced in the build of the latest release.
This issue caused all utilities to not work when decorating a Lambda handler, the reason was AspectInjector dll was not present as a reference for the NuGet package of the utilities.
We immediately detect the issue in our manual tests, and unlisted the affected versions from NuGet.
TLDR:
To prevent this from happening
- We have included E2E tests in GitHub build for the examples
- We have included a test that guarantees that we are using version 2.8.1 of AspectInjector
- We have included tests in our internal build system that run examples tests on non-released nuget packages
The issue demonstrated bellow:
With missing dependencies
With correct dependencies
🐛 Bug and hot fixes
🔧 Maintenance
This release was made possible by the following contributors:
1.7.0
Summary
In this release we are please to announce the removal of the Common dependency and Nuget package 🎉 and introducing NuGet Central Package Management (i.e. with Directory.Packages.props).
All utilities updated:
- AWS.Lambda.Powertools.Logging - 1.3.0
- AWS.Lambda.Powertools.Tracing - 1.3.0
- AWS.Lambda.Powertools.Metrics - 1.4.0
- AWS.Lambda.Powertools.Parameters - 1.1.0
- AWS.Lambda.Powertools.Idempotency - 0.2.0-preview
Utilities have a dependency on the AWS.Lambda.Powertools.Common project.
When the utility is compiled and packaged into a nuget package the AWS.Lambda.Powertools.Common is a dependency.
This behaviour is causing Diamond dependency issues in the project.
To address this we copy the required files to each utility and make them completely isolated. This allows the client to not have to worry about dependencies between utilities and AWS.Lambda.Powertools.Common.
There is no need to delete the AWS.Lambda.Powertools.Common project but link the files in other projects, this will make it more readable in the solution explorer and makes maintenance easier because it's all in a single project.
TLDR
- Add
Directory.Build.props
andDirectory.Build.targets
more info- These two files allows us to modify all csproj files in the solution or where the files are placed in the folder structure
- Those files were added to the
src
folder. They modify all csproj in that folder where all utilities are. Search scope
- Add Central Package Management more info
- Dependency management is a core feature of NuGet. Managing dependencies for a single project can be easy. Managing dependencies for multi-project solutions can prove to be difficult as they start to scale in size and complexity. In situations where you manage common dependencies for many different projects, you can leverage NuGet's central package management (CPM) features to do all of this from the ease of a single location.
- Add a file
Directory.Packages.props
to the src and test folders. This allows us to manage nuget package versions for all projects in a central location. I separated src and tests because tests have many dependencies and can cause confusion. Search scope info
Implementation
Part 1 Directory.Build.props
- Use MSbuild to:
Part 2 Directory.Build.targets
(changes only happen in Release configuration)
- Use MSbuild to:
- Copy/Link
AWS.Lambda.Powertools.Common
*.cs files to the destination project - Remove depdendency of Common project by removing
<ProjectReference Remove="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj" />
- Add PackageReference
<PackageReference Include="AspectInjector" />
- Copy/Link
- This transformation only happens in Release configuration
Once in Release
configuration or when running dotnet build -c Release
the Common folder is added to the project
Part 3 Central Package Management
Starting with NuGet 6.2, you can centrally manage your dependencies in your projects with the addition of a Directory.Packages.props file and an MSBuild property.
This means that the versions of the referenced packages will be defined in the central Directory.Packages.props
file
In the csproj files of the projects the referenced packages will not have a version
If needed individual projects can override the version
Part 4 Nuget package contents
The resulting Release package will have no AWS.Lambda.Powertools.Common
reference and will include AspectInjector
nuget package. This will make the utility completely independent from AWS.Lambda.Powertools.Common
Nuget package at runtime
Old:
New:
Removed AWS.Lambda.Powertools.Common
project reference from test projects.
This reference now comes from Directory.Build.props
. This file was added to test folder.
Changes
🌟New features and non-breaking changes
🔧 Maintenance
- chore: Disable dependabot.yml (#475) by @hjgraca
- chore: Update version release 1.7.0 (#464) by @hjgraca
- chore(deps): bump gitpython from 3.1.30 to 3.1.35 (#451) by @dependabot
- chore: update changelog with latest changes (#437) by @hjgraca
- chore: bump examples NuGet versions (#435) by @amirkaws
This release was made possible by the following contributors:
1.6.0
Summary
With this release, we move Parameters utility from Developer Preview to General Availability 🎉🎉🎉!, we also released Tracing automatic register for services.
Parameters
This new utility provides high-level functionality to retrieve one or multiple parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB. We also provide extensibility to bring your own providers. Here is an example for SSM Parameter Store.
using AWS.Lambda.Powertools.Parameters;
using AWS.Lambda.Powertools.Parameters.SimpleSystemsManagement;
public class Function
{
public async Task<APIGatewayProxyResponse> FunctionHandler
(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
{
// Get SSM Provider instance
ISsmProvider ssmProvider = ParametersManager.SsmProvider;
// Retrieve a single parameter
string? value = await ssmProvider
.GetAsync("/my/parameter")
.ConfigureAwait(false);
// Retrieve multiple parameters from a path prefix
// This returns a Dictionary with the parameter name as key
IDictionary<string, string?> values = await ssmProvider
.GetMultipleAsync("/my/path/prefix")
.ConfigureAwait(false);
}
}
Instrumenting SDK clients and HTTP calls
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.Model;
using AWS.Lambda.Powertools.Tracing;
public class Function
{
private static IAmazonDynamoDB _dynamoDb;
/// <summary>
/// Function constructor
/// </summary>
public Function()
{
Tracing.RegisterForAllServices();
_dynamoDb = new AmazonDynamoDBClient();
}
}
To instrument clients for some services and not others, call Register instead of RegisterForAllServices. Replace the highlighted text with the name of the service's client interface.
public class Function
{
private static IAmazonDynamoDB _dynamoDb;
/// <summary>
/// Function constructor
/// </summary>
public Function()
{
Tracing.Register<IAmazonDynamoDB>()
_dynamoDb = new AmazonDynamoDBClient();
}
}
Changes
🌟New features and non-breaking changes
📜 Documentation updates
- feat: Automatic Register XRay for all services (#428) by @amirkaws
- chore: include mermaid in mkdocs config. Fix identation and line numbers idempotency (#400) by @hjgraca
🔧 Maintenance
- chore: Update version release 1.6.0 (#430) by @amirkaws
- chore: include mermaid in mkdocs config. Fix identation and line numbers idempotency (#400) by @hjgraca
- chore: Update dependabot.yml (#391) by @hjgraca
This release was made possible by the following contributors:
1.5.0
Summary
In this release we are happy to add support for Idempotency InProgressExpiration timestamp.
This field is required to prevent against extended failed retries when a Lambda function times out, Powertools for AWS Lambda (.NET) calculates and includes the remaining invocation available time as part of the idempotency record.
If a second invocation happens after this timestamp, and the record is marked as INPROGRESS, we will execute the invocation again as if it was in the EXPIRED state (e.g, expire_seconds field elapsed).
This means that if an invocation expired during execution, it will be quickly executed again on the next retry.
When decorating the handler with Idempotent attribute we will do it automatically by getting the RemainingTime
value from the ILambdaContext that is passed to the handler.
RemainingTime
is the remaining execution time till the function will be terminated. At the time you create the Lambda function you set maximum time limit, at which time AWS Lambda will terminate the function execution.
Information about the remaining time of function execution can be used to specify function behavior when nearing the timeout.
When using Idempotent attribute on another method to guard isolated parts of your code, you must use RegisterLambdaContext
available in the Idempotency
static class to benefit from this protection.
Here is an example on how you register the Lambda context in your handler:
Lambda request timeout diagram
Changes
🌟New features and non-breaking changes
- feat: Idempotency calculate remaining invocation available time as part of the idempotency record (#363) by @hjgraca
📜 Documentation updates
- feat: Idempotency calculate remaining invocation available time as part of the idempotency record (#363) by @hjgraca
This release was made possible by the following contributors:
1.4.2
Summary
In this release we are excited to announce the release of custom log formatter support. You can customize the structure (keys and values) of your log entries by implementing a custom log formatter and override default log formatter using Logger.UseFormatter
method. You can implement a custom log formatter by inheriting the ILogFormatter
class and implementing the object FormatLogEntry(LogEntry logEntry)
method.
We are also happy to announce the support for adding the Idempotent attribute on any method, not only the Lambda handler.
We also removed Moq library from our tests and replaced it with NSubsitute due to privacy concerns
We also made improvements to how we handle when an exception is thrown inside a method that is decorated with Powertools utilities the user should see the full stack trace for that exception.
Note
This change required us to update all utilities (Common). To avoid issues please update to the latest version all utilities you are using in your projects.
We are working to remove the dependency on Common (#339)
Custom log formatter
Idempotent attribute on another method
You can use the Idempotent attribute for any .NET function, not only the Lambda handlers.
When using Idempotent attribute on another method, you must tell which parameter in the method signature has the data we should use:
- If the method only has one parameter, it will be used by default.
- If there are 2 or more parameters, you must set the IdempotencyKey attribute on the parameter to use.
Full list of changes
🌟New features and non-breaking changes
- feat: Add bring your own log formatter to logger (#375) by @amirkaws
- feat: idempotent function (#349) by @hossambarakat
📜 Documentation updates
🐛 Bug and hot fixes
🔧 Maintenance
- chore: Idempotency - refactor example to be simpler with a comparable idempotent output (#342) by @hjgraca
- chore: Replace Moq NuGet package with NSubstitute (#370) by @amirkaws
- chore(deps): bump AWSSDK.SecretsManager from 3.7.102.38 to 3.7.200.3 in /libraries (#359) by @dependabot
- chore(deps): bump xunit from 2.4.1 to 2.4.2 in /libraries (#328) by @dependabot
- chore(deps): bump AWSSDK.DynamoDBv2 from 3.7.103.1 to 3.7.104.1 in /libraries (#327) by @dependabot
- chore(deps): bump AWSXRayRecorder.Core from 2.13.0 to 2.14.0 in /libraries (#325) by @dependabot
- chore(deps): bump Testcontainers from 3.2.0 to 3.3.0 in /libraries (#326) by @dependabot
- chore(deps): bump Moq from 4.18.1 to 4.18.4 in /libraries (#329) by @dependabot
This release was made possible by the following contributors:
1.4.1
Summary
In this release we patch Metrics utility to version 1.3.2.
With this release we are releasing a fix that ensures that when a new data point is added, and the limit is reached, all the stored metrics are flushed right away.
Also release a fix for a race condition on the metrics utilities.
No changes in other utilities.
Metrics
Prior to this release the Metrics utility allowed to add a number of data points greater than the current limit of 100 data points set by the EMF specification.
If you are using Metrics in your workloads and are dealing with a large number of datapoints, we encourage to update to the latest version of the package at your earliest convenience.
📜 Documentation updates
- docs: Parameters example (#298) by @amirkaws
- chore: update urls to new format. remove latest from .net url (#315) by @hjgraca
- docs: ASP.NET Core WebAPI example(s) (#287) by @swimming-potato
- docs: Add Idempotency example (#300) by @hossambarakat
🐛 Bug and hot fixes
- fix: Prevent a single metric have more than 100 data points (#312) by @hjgraca
- fix: Metrics Race condition if using Async calls (#313) by @hjgraca
🔧 Maintenance
- chore: Update dependabot.yml (#318) by @hjgraca
- chore: Bump logging version to fix idempotency example (#320) by @hjgraca
- chore: Idempotency examples - Update AWSSDK.DynamoDBv2 version (#319) by @hjgraca
- chore: Create dependabot.yml to enable dependabot (#317) by @hjgraca
- docs: Parameters example (#298) by @amirkaws
- chore: update urls to new format. remove latest from .net url (#315) by @hjgraca
- chore: Readme updates (#314) by @hjgraca
- chore: remove GH pages (#303) by @sthulb
- chore: update changelog with latest changes (#308) by @hjgraca
This release was made possible by the following contributors:
@amirkaws, @hjgraca, @hossambarakat, @sthulb and @swimming-potato
1.4.0
Summary
In this release we are happy to announce the first developer preview for the new Idempotency utility 🚀. The Idempotency utility provides a simple solution to convert your Lambda functions into idempotent operations which are safe to retry.
This utility is currently in developer preview and is intended strictly for feedback and testing purposes and not for production workloads. The version and all future versions tagged with the -preview suffix should be treated as not stable. Until this utility is General Availability we may introduce significant breaking changes and improvements in response to customers feedback.
🌟Key features
- Prevent Lambda handler function from executing more than once on the same event payload during a time window.
- Use DynamoDB as a persistence layer for state with bring your own persistence store provider.
- Select a subset of the event as the idempotency key using JMESPath expressions.
- Payload validation to provide an additional JMESPath expression to specify which part of the event body should be validated against previous idempotent invocations.
Implementation example
Quick links: 📜 Documentation | ⬇️ NuGet | 🐛 Bug Report
🌟New features and non-breaking changes
- feat: Add ClearAllDimensions Method (#293) by @glynn1211
- feat(docs): Start S3 Docs (#278) by @sthulb
📜 Documentation updates
- chore(docs): doc and readme updates (#301) by @sliedig
- docs: Update roadmap and maintainers (#291) by @hjgraca
- docs(parameter): adding required permission to SSM provider (#273) by @leandrodamascena
🐛 Bug and hot fixes
- fix: rename repository to powertools-lambda-dotnet (#302) by @sthulb
- chore(deps): update mkdocs configuration to support pymdown-extensions 10.0 (#276) by @hjgraca
- fix: parameters nuget icon (#271) by @amirkaws
🔧 Maintenance
- chore: Change repo URL to the new location (#285) by @sthulb
- chore: rename project to Powertools for AWS Lambda (.NET) (#282) by @sthulb
- chore: update changelog with latest changes (#277) by @hjgraca
- chore(deps): Bump pymdown-extensions from 9.9 to 10.0 (#276) by @hjgraca
This release was made possible by the following contributors:
@amirkaws, @hjgraca , @hossambarakat and @sliedig, @glynn1211 , @leandrodamascena , @sthulb and @glynn1211
1.3.0
Changes
In this release we are excited to announce the first developer preview for the new Parameters utility 🎉. This new utility provides high-level functionality to retrieve one or multiple parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB. We also provide extensibility to bring your own providers.
This utility is currently in developer preview and is intended strictly for feedback and testing purposes and not for production workloads. The version and all future versions tagged with the -preview suffix should be treated as not stable. Until this utility is General Availability we may introduce significant breaking changes and improvements in response to customers feedback.
🌟Key features
- Retrieve one or multiple parameters from the underlying provider
- Cache parameter values for a given amount of time (defaults to 5 seconds)
- Transform parameter values from JSON or base 64 encoded strings
- Bring your own parameter store provider
--
Quick links: 📜 Documentation | ⬇️ NuGet | 🐛 Bug Report