Releases: aws-powertools/powertools-lambda-dotnet
v3.0.1
Summary
In this release we fix two bugs introduced in the last release.
- AspectInjector dependency that was causing build issues in large projects
Tracingutility regression introduced when we added a new way to create subsegments.
📜 Announcement: You can now find our documentation on the official AWS documentation domain at [docs.aws.amazon.com/powertools/dotnet](https://docs.aws.amazon.com/powertools/dotnet/).
Thanks @nCubed for reporting the AspectInjector issue
Changes
🐛 Bug and hot fixes
- fix: tracing subsegment when using fluent api Tracing.WithSubsegment (#1032) by @hjgraca
- chore: downgrade AspectInjector to version 2.8.1 (#1040) by @hjgraca
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
00f9276tof5c556ain /docs (#1041) by @dependabot[bot] - chore: add aws docs javascript bootstrap (#1016) by @hjgraca
🔧 Maintenance
- chore: Bump version from 3.0.0 to 3.0.1 (#1047) by @hjgraca
- chore(deps): bump actions/setup-node from 5.0.0 to 6.0.0 (#1039) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.30.6 to 4.30.9 (#1045) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
00f9276tof5c556ain /docs (#1041) by @dependabot[bot] - chore: Update contributing.md (#1043) by @ConnorKirk
- chore: add aws docs javascript bootstrap (#1016) by @hjgraca
- chore: Update examples with latest nuget versions. Fix PTENV check in tests (#1030) by @hjgraca
- chore: update version to 3.0.0 (#1027) by @github-actions[bot]
- chore: update version workflow fix version retrieval using tag (#1025) by @hjgraca
- chore: fix workflow specify branch (#1023) by @hjgraca
This release was made possible by the following contributors:
@ConnorKirk, @dependabot[bot], @hjgraca, dependabot[bot] and github-actions[bot]
v3.0.0
Summary
We're excited to announce a major release with new features and important updates:
- Strongly-typed batch processor with automatic deserialization for SQS, Kinesis, and DynamoDB events
- Enhanced tracing with improved metadata error handling
- Bug fix for logging sampling rate
This major version bump reflects significant breaking changes as we update our supported runtimes and dependencies.
Breaking Changes
- Removed support for .NET 6 - We now require .NET 8 or later
- AWS SDK v3 no longer supported - We have migrated to AWS SDK v4
- Version alignment - All Powertools for AWS Lambda utilities will maintain version parity going forward
New Features
Strongly-Typed Batch Processor
Process batch events with type safety and automatic deserialization.
What's New:
ITypedRecordHandler<T>andITypedRecordHandlerWithContext<T>interfaces for strongly-typed processing- Specialized processors:
TypedSqsBatchProcessor,TypedKinesisEventBatchProcessor,TypedDynamoDbStreamBatchProcessor - Automatic JSON deserialization from event records to your types
- Optional
ILambdaContextinjection for timeout handling and request tracking
Example Usage:
Simple typed handler:
public class OrderHandler : ITypedRecordHandler<Order>
{
public async Task<RecordHandlerResult> HandleAsync(Order order, CancellationToken cancellationToken)
{
// Direct access to strongly-typed object - no manual deserialization!
await ProcessOrder(order);
return RecordHandlerResult.Successful;
}
}With Lambda context support (docs):
public class ProductHandlerWithContext : ITypedRecordHandlerWithContext<Product>
{
public async Task<RecordHandlerResult> HandleAsync(Product product, ILambdaContext context, CancellationToken cancellationToken)
{
Logger.LogInformation($"Processing product {product.Id} in request {context.AwsRequestId}");
Logger.LogInformation($"Remaining time: {context.RemainingTime.TotalSeconds}s");
// Use context for timeout handling
if (context.RemainingTime.TotalSeconds < 5)
{
Logger.LogWarning("Low remaining time, processing quickly");
}
return RecordHandlerResult.Successful;
}
}Contributors
Thank you @dcabib for your contributions to this release! ⭐
Changes
🐞 Bug fixes
📜 Documentation updates
- chore: remove dotnet6 from docs and add migration guides for v2 and v3 (#1021) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
86d21dato00f9276in /docs (#1013) by @dependabot[bot] - chore: Tracing sanitize metadata (#1011) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
209b62dto86d21dain /docs (#996) by @dependabot[bot]
🔧 Maintenance
- chore: remove dotnet6 from docs and add migration guides for v2 and v3 (#1021) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
86d21dato00f9276in /docs (#1013) by @dependabot[bot] - chore(deps): bump aws-actions/configure-aws-credentials from 5.0.0 to 5.1.0 (#1020) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.30.5 to 3.30.6 (#1014) by @dependabot[bot]
- chore(deps): bump ossf/scorecard-action from 2.4.2 to 2.4.3 (#1012) by @dependabot[bot]
- chore: version update automation (#1018) by @hjgraca
- chore: Tracing sanitize metadata (#1011) by @hjgraca
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.25 to 4.0.0 (#1008) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.30.4 to 3.30.5 (#1007) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.30.3 to 3.30.4 (#1004) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
209b62dto86d21dain /docs (#996) by @dependabot[bot] - chore: update AWS SDK dependencies (#999) by @hjgraca
- chore: update environment variable references to use AWS_SDK_UA_APP_ID (#934) by @hjgraca
- chore: drop .NET 6 support, go .NET 8 only #995 @dcabib
- chore: Upgrade to AWS sdk v4 #998 @dcabib
- feat: batch deserialize event records #970 @hjgraca
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca and dependabot[bot]
1.60.1
Summary
In this release, we resolved thread safety issues in the Metrics utility that were causing exceptions when multiple threads attempted to collect metrics simultaneously.
Thanks @lachriz-aws for reporting and helping investigate this issue! 🙏
🐛 Bug and hot fixes
fix: concurrency issues in Metrics (#1001) by @hjgraca
1.60.0
Summary
This release introduces a new feature for the Idempotency utility that allows developers to manipulate the returned data from idempotent operations, providing greater flexibility and control over the response handling process.
Congratulations @Diogobitten for your first contribution ⭐
Manipulating idempotent responses
Now you can set up a response hook in the Idempotency configuration to modify the returned data when an operation is idempotent. The hook function is called with the current deserialized response object and the Idempotency DataRecord, allowing you to add custom logic or modify the response as needed.
Idempotency.Config()
.WithConfig(IdempotencyOptions.Builder()
.WithEventKeyJmesPath("powertools_json(body).address")
.WithResponseHook((responseData, dataRecord) => {
if (responseData is APIGatewayProxyResponse proxyResponse)
{
proxyResponse.Headers ??= new Dictionary<string, string>();
proxyResponse.Headers["x-idempotency-response"] = "true";
proxyResponse.Headers["x-idempotency-expiration"] = dataRecord.ExpiryTimestamp.ToString();
return proxyResponse;
}
return responseData;
})
.Build())
.WithPersistenceStore(DynamoDBPersistenceStore.Builder()
.WithTableName(Environment.GetEnvironmentVariable("IDEMPOTENCY_TABLE"))
.Build())
.Configure();Changes
🌟New features and non-breaking changes
📜 Documentation updates
- chore: Remove reference customer section from documentation (#982) by @hjgraca
- chore: Update copyright information in mkdocs.yml (#976) by @hjgraca
- feat: Add support for response hooks in idempotency utility (#968) by @hjgraca
🔧 Maintenance
- chore: Update version for release (#986) by @hjgraca
- chore: Remove reference customer section from documentation (#982) by @hjgraca
- chore: Update copyright information in mkdocs.yml (#976) by @hjgraca
- chore(deps): bump brace-expansion in /examples/Event Handler/BedrockAgentFunction/infra (#973) by @dependabot[bot]
- chore(deps): bump codecov/codecov-action from 5.4.3 to 5.5.0 (#967) by @dependabot[bot]
- chore(gitignore): add .kiro, .claude, .amazonq to prevent deletion (#971) by @Diogobitten
This release was made possible by the following contributors:
@Diogobitten, @dependabot[bot], @dreamorosi, @hjgraca and dependabot[bot]
1.54
Summary
In this release we fix a bug in the Logging utility where requests containing duplicate HTTP headers (such as multiple Content-Type headers) cause an unhandled exception. When duplicate headers are present, the last header is taken.
Thank you @SamuelGuine for reporting the issue
Changes
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
bb7b015to1a4e939in /docs (#964) by @dependabot[bot] - chore(deps): bump squidfunk/mkdocs-material from
0bfdba4tobb7b015in /docs (#947) by @dependabot[bot]
🐛 Bug and hot fixes
🔧 Maintenance
- chore: Update Logging version to 2.0.2 (#966) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
bb7b015to1a4e939in /docs (#964) by @dependabot[bot] - chore(deps): bump github/codeql-action from 3.29.7 to 3.29.11 (#963) by @dependabot[bot]
- chore(deps): bump aws-powertools/actions from 1.4.0 to 1.5.0 (#959) by @dependabot[bot]
- chore(deps): bump actions/checkout from 4.2.2 to 5.0.0 (#957) by @dependabot[bot]
- chore(deps): bump actions/download-artifact from 4.3.0 to 5.0.0 (#953) by @dependabot[bot]
- chore(deps): bump aws-actions/configure-aws-credentials from 4.2.1 to 4.3.1 (#952) by @dependabot[bot]
- chore(deps): bump aws-powertools/actions from 1.3.0 to 1.4.0 (#949) by @dependabot[bot]
- chore(deps): bump aws-powertools/actions from 1.2.0 to 1.3.0 (#946) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
0bfdba4tobb7b015in /docs (#947) by @dependabot[bot] - chore(deps): bump github/codeql-action from 3.29.4 to 3.29.5 (#948) by @dependabot[bot]
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca, @leandrodamascena and dependabot[bot]
1.53
Summary
In this release we improved our Idempotency utility and storage layer is now faster and cheaper by leveraging conditional writes. We also made important changes to the Logger and Metrics utility.
Special thanks to @j-d-ha for reporting logging issues and @sdangol for their first contribution to the project.
Logging
We've enhanced the AddPowertoolsLogger method with improved service registration and added automatic ILogger interface registration. A new ClearExistingProviders option is now available to prevent multiple logger providers.
builder.Logging.AddPowertoolsLogger(config =>
{
config.Service = "TestService";
config.LoggerOutputCase = LoggerOutputCase.PascalCase;
}, clearExistingProviders: true);Metrics
Before this release, if you published invalid metrics they could fail silently, leading to data loss. Now Lambda will raise an exception if the following constraints do not hold:
- Metric Name: Validated according to CloudWatch constraints
- Metric Value: Validated for numeric values
- Metric Unit: Validated for allowed units
- Metric Resolution: Validated for allowed resolutions
- Dimension Name: Both Dimension name and value are validated for non empty, non-null values.
Idempotency
Several months ago AWS introduced support for ReturnValuesOnConditionCheckFailure, a feature designed to streamline conditional write operations and reducing costs in Amazon DynamoDB. With this enhancement, Powertools for AWS Lambda now optimistically attempts to write items to DynamoDB. If the item already exists, it seamlessly returns it without requiring an additional operation.
Changes
🌟New features and non-breaking changes
- feat(metrics): Added runtime validation for the metric name (#943) by @sdangol
- feat: add support for ReturnValuesOnConditionCheckFailure in Idempotency (#930) by @hjgraca
📜 Documentation updates
🔧 Maintenance
- chore: Update version.json for release 1.53 (#945) by @hjgraca
- chore(deps): bump github/codeql-action from 3.29.3 to 3.29.4 (#941) by @dependabot[bot]
- chore(deps): bump aws-powertools/actions from 29979bc5339bf54f76a11ac36ff67701986bb0f0 to 7d2401cbbb232594bde7285bc5b8c0c78dcbe6e2 (#942) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (#939) by @dependabot[bot]
- chore: Add automatic registration of standard logging services and ILogger (#938) by @hjgraca
- chore: Console output overrides lambda console out (#936) by @hjgraca
- chore: Add missing PTENV to user agent (#927) by @hjgraca
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca, @sdangol, @swopnildangol and dependabot[bot]
1.52
Summary
We're thrilled to announce the addition of support for multiple dimension sets within the same Metrics instance. This new feature allows users to gain more granular insights and comprehensive views of their applications by creating aggregating metrics across various dimensions.
Key Features
- New
AddDimensions()method for adding multiple dimensions at once - Support for multiple dimension sets in a single Metrics instance
- Maintains backwards compatibility with existing
AddDimension()method - Automatic handling of duplicate dimension sets
- Ensures only the latest dimension value is used as a target member on the root EMF node
Getting Started
To leverage this new functionality, simply use the new AddDimensions() method in your code:
Metrics.AddDimensions(("environment", "prod"), ("region", "us-west-2"));
Metrics.AddDimensions(("environment", "prod"));
Metrics.AddDimensions(("region", "us-west-2"));
Metrics.AddMetric("ExecutionTime", DateTime.Now, Unit.MILLISECONDS);This will generate CloudWatch Metrics with multiple dimension sets, allowing for more flexible and detailed metric analysis.
Enhanced Metric Output
The new feature produces an enhanced metric output structure, as shown in this example:
{
"_aws": {
"Timestamp": 1742467748165,
"CloudWatchMetrics": [
{
"Namespace": "HelloWorldFunction",
"Metrics": [
{
"Name": "ExecutionTime",
"Unit": "Milliseconds"
}
],
"Dimensions": [
[
"Service"
],
[
"environment",
"region"
],
[
"environment"
],
[
"region"
]
]
}
]
},
"function_request_id": "c0e5afc1-c033-4aa6-9b13-26bfc324874b",
"ExecutionTime": 0.0,
"environment": "prod",
"functionVersion": "$LATEST",
"Service": "Powertools",
"logStreamId": "$LATEST",
"region": "us-west-2",
"executionEnvironment": "AWS_Lambda_java17"
}Changes
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
eb04b60to0bfdba4in /docs (#921) by @dependabot[bot]
🔧 Maintenance
- chore: Update version.json (#925) by @hjgraca
- chore: fix e2e tests (#875) by @hjgraca
- chore: add support for multiple dimensions (#884) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
eb04b60to0bfdba4in /docs (#921) by @dependabot[bot]
This release was made possible by the following contributors:
1.51.1
Summary
We're excited to announce the latest release of Powertools for AWS Lambda (.NET), which brings improvements to our Kafka integration.
Kafka Consumer
We've improved our Kafka integration by removing the dependency on the Kafka base package from the consumer packages. The base package is now bundled, making it easier to consume and integrate.
Updated packages:
- AWS.Lambda.Powertools.Kafka.Json (v1.0.2)
- AWS.Lambda.Powertools.Kafka.Protobuf (v1.0.2)
- AWS.Lambda.Powertools.Kafka.Avro (v1.0.2)
Key features:
- Automatic deserialization of Kafka messages (JSON, Avro, and Protocol Buffers)
- Simplified event record handling with an intuitive interface
- Support for key and value deserialization
- ESM support with and without Schema Registry integration
- Improved error handling for deserialization issues
To get started, install the library corresponding to your schema type:
- JSON schemas:
dotnet add package AWS.Lambda.Powertools.Kafka.Json - Avro schemas:
dotnet add package AWS.Lambda.Powertools.Kafka.Avro - Protocol Buffer schemas:
dotnet add package AWS.Lambda.Powertools.Kafka.Protobuf
Changes
🔧 Maintenance
- chore: update Kafka deserialization to use alias for ConsumerRecords (#922) by @hjgraca
- chore: remove redundant license comments from multiple files (#920) by @hjgraca
- chore(deps): bump github/codeql-action from 3.29.0 to 3.29.2 (#918) by @dependabot[bot]
- chore: Fix kafka dependencies (#913) by @hjgraca
- chore: add missing UA to event handler and bedrock agents (#917) by @hjgraca
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca and dependabot[bot]
1.51
Summary
We're excited to announce the Kafka Consumer utility, which transparently handles message deserialization, provides an intuitive developer experience, and integrates seamlessly with the rest of the Powertools for AWS Lambda ecosystem.
Key features
- Automatic deserialization of Kafka messages (JSON, Avro, and Protocol Buffers)
- Simplified event record handling with intuitive interface
- Support for key and value deserialization
- Support for ESM with and without Schema Registry integration
- Proper error handling for deserialization issues
Getting started
To get started, depending on the schema types you want to use, install the library and the corresponding libraries:
- JSON schemas
dotnet add package AWS.Lambda.Powertools.Kafka.Json - Avro schemas
dotnet add package AWS.Lambda.Powertools.Kafka.Avro - Protocol Buffer schemas
dotnet add package AWS.Lambda.Powertools.Kafka.Protobuf
Processing Kafka events
You can use Kafka consumer utility to transform raw Kafka events into an intuitive format for processing.
The Handler function can deserialize both keys and values independently based on your schema configuration. This flexibility allows you to work with different data formats in the same message.
Working with Avro:
Working with Protocol Buffers:
Working with JSON messages:
Error handling
You can handle errors when processing Kafka messages to ensure your application maintains resilience and provides clear diagnostic information.
The Kafka consumer utility integrates with standard C# exception handling patterns.
To learn more about the launch, read the blog post published alongside the release.
🌟New features and non-breaking changes
📜 Documentation updates
- docs: add Kafka Consumer utility documentation (#906) by @hjgraca
- chore: Update mkdocs.yml (#898) by @hjgraca
- chore: Feature/bedrock agent function resolver (#894) by @hjgraca
- chore: Add Instil as a customer ref (#896) by @hjgraca
- chore: Add llms.txt to documentation (#893) by @hjgraca
🔧 Maintenance
- chore(deps): bump urllib3 from 2.3.0 to 2.5.0 (#907) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.28.19 to 3.29.0 (#902) by @dependabot[bot]
- chore(deps): bump requests from 2.32.3 to 2.32.4 (#901) by @dependabot[bot]
- chore: Feature/kafka consumer (#905) by @hjgraca
- chore(deps): bump github/codeql-action from 3.28.18 to 3.28.19 (#899) by @dependabot[bot]
- chore(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 (#897) by @dependabot[bot]
- chore: Update mkdocs.yml (#898) by @hjgraca
- chore: Feature/bedrock agent function resolver (#894) by @hjgraca
- chore: Add Instil as a customer ref (#896) by @hjgraca
- chore: Add llms.txt to documentation (#893) by @hjgraca
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca and dependabot[bot]
1.50.2
Summary
We're excited to announce that with this release, the Batch Processing and Parameters utilities now support native AOT compilation, completing native AOT support across all Powertools utilities!
Batch processing and Parameters native AOT support
What is Native AOT?
Native AOT (Ahead-of-Time) compilation transforms your .NET applications into self-contained native executables, offering:
- Up to 60% faster cold start times
- Reduced memory footprint (up to 80% smaller in some scenarios)
- Zero JIT compilation overhead
- Optimizations for serverless and containerized environments
Working with native AOT
To get started with native AOT you need to update your Lambda function's runtime to .NET 8 and add the following to your project file:
<PropertyGroup>
<PublishAot>true</PublishAot>
</PropertyGroup>Changes
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
f6c81d5toeb04b60in /docs (#880) by @dependabot[bot] - chore(deps): bump squidfunk/mkdocs-material from
95f2ff4tof6c81d5in /docs (#879) by @dependabot[bot]
🔧 Maintenance
- chore: update batch and parameters version for release 1.50.2 (#891) by @hjgraca
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.24 to 3.0.25 (#889) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.28.17 to 3.28.18 (#888) by @dependabot[bot]
- chore(deps): bump codecov/codecov-action from 5.4.2 to 5.4.3 (#885) by @dependabot[bot]
- chore(deps): bump aws-actions/configure-aws-credentials from 4.2.0 to 4.2.1 (#883) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f6c81d5toeb04b60in /docs (#880) by @dependabot[bot] - chore: Add AOT support Parameters utility (#882) by @hjgraca
- chore: Feature/batch aot support (#881) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
95f2ff4tof6c81d5in /docs (#879) by @dependabot[bot] - chore(deps): bump aws-actions/configure-aws-credentials from 4.1.0 to 4.2.0 (#876) by @dependabot[bot]
This release was made possible by the following contributors:
@dependabot[bot], @hjgraca and dependabot[bot]



