Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900)
[![Build](https://github.com/aws-powertools/powertools-lambda-dotnet/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/aws-powertools/powertools-lambda-dotnet/actions/workflows/build.yml)
[![codecov.io](https://codecov.io/github/aws-powertools/powertools-lambda-dotnet/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/aws-powertools/powertools-lambda-dotnet)
[![dotnet support](https://img.shields.io/static/v1?label=dotnet&message=%20NET8.0&color=blue?style=flat-square&logo=dotnet)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
[![dotnet support](https://img.shields.io/static/v1?label=dotnet&message=%20NET10.0&color=blue?style=flat-square&logo=dotnet)](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)
[![NuGet Downloads](https://img.shields.io/nuget/dt/AWS.Lambda.Powertools.Logging.svg)](https://www.nuget.org/packages?q=AWS.Lambda.Powertools) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-dotnet/badge)](https://scorecard.dev/viewer/?uri=github.com/aws-powertools/powertools-lambda-dotnet)
[![Discord](https://img.shields.io/badge/Discord-Join_Community-7289da.svg)](https://discord.gg/B8zZKbbyET)

Expand Down Expand Up @@ -90,7 +90,7 @@ The Powertools for AWS Lambda (.NET) utilities are available as NuGet packages.

## 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 8 managed runtime; or as a container package using the AWS base images for .NET.
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 10 managed runtime; or as a container package using the AWS base images for .NET.

* **[Logging example](examples/Logging/)**
* **[Metrics example](examples/Metrics/)**
Expand Down
105 changes: 105 additions & 0 deletions docs/migration-guide-v4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
title: Migration Guide v4
slug: migration-guide-v4
description: Migration guide to upgrade to v4 (.NET 10)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a major version release

---

# Migration Guide to v4

This guide will help you migrate to v4, which targets the .NET 10 LTS runtime.

## Why upgrade

* **.NET 10 is the current LTS release** - Generally available since November 2025 and supported until November 10, 2028.
* **.NET 8 support is ending** - .NET 8 (LTS) reaches end of support on November 10, 2026. Production applications should move to .NET 10 for the extended support window.
* **Performance and cost** - .NET 10 brings JIT and GC improvements plus expanded Native AOT support, which translate directly into faster cold starts and lower memory usage for Lambda functions.

## Breaking Changes

⚠️ Important: Please review these breaking changes before upgrading:

* Requires .NET 10 - The Powertools packages and examples now target `net10.0`.
* AWS Lambda managed runtime is now `dotnet10` - Update your SAM templates and function configuration accordingly.

> The Powertools for AWS Lambda (.NET) libraries multi-target `net8.0` and `net10.0`, so they remain compatible with .NET 8 during your transition. The examples and recommended runtime, however, now use .NET 10.

## Upgrade Steps

### 1. Install the .NET 10 SDK

Download and install the .NET 10 SDK from [https://dotnet.microsoft.com/download/dotnet/10.0](https://dotnet.microsoft.com/download/dotnet/10.0).

Verify the installation:

```bash
dotnet --list-sdks
```

### 2. Update Target Framework

Update your `.csproj` file to target .NET 10:

**Before (v3):**
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
```

**After (v4):**
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>
```

### 3. Update the Lambda Runtime

Update your AWS SAM templates (and any function configuration) to use the `dotnet10` managed runtime:

**Before (v3):**
```yaml
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: dotnet8
```

**After (v4):**
```yaml
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: dotnet10
```

### 4. Update Powertools Packages

Update all Powertools package references to v4:

```xml
<ItemGroup>
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="4.0.*" />
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="4.0.*" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="4.0.*" />
</ItemGroup>
```

### 5. Native AOT considerations

When publishing with Native AOT, the build OS and architecture must match the target platform (Amazon Linux 2023). The AWS tooling (AWS Toolkit for Visual Studio, the `Amazon.Lambda.Tools` .NET global tool, and the SAM CLI) performs a container build using a .NET 10 Amazon Linux 2023 build image when `PublishAot` is set to `true`. Docker is required when packaging .NET Native AOT Lambda functions on non-Amazon Linux 2023 build environments.

### 6. Build and test

Rebuild and run your test suite to confirm the upgrade:

```bash
dotnet build
dotnet test
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AWSProjectType>Lambda</AWSProjectType>
Expand Down
2 changes: 1 addition & 1 deletion examples/AOT/AOT_Logging/src/AOT_Logging/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set to `true` to strip debugging symbols from the deployed executable to reduce

When publishing with Native AOT the build OS and Architecture must match the target platform that the application will run. For AWS Lambda that target
platform is Amazon Linux 2023. The AWS tooling for Lambda like the AWS Toolkit for Visual Studio, .NET Global Tool Amazon.Lambda.Tools and SAM CLI will
perform a container build using a .NET 8 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
perform a container build using a .NET 10 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
when packaging .NET Native AOT Lambda functions on non-Amazon Linux 2023 build environments. To install docker go to https://www.docker.com/.

### Trimming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "AOT_Logging",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AWSProjectType>Lambda</AWSProjectType>
Expand Down
2 changes: 1 addition & 1 deletion examples/AOT/AOT_Metrics/src/AOT_Metrics/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set to `true` to strip debugging symbols from the deployed executable to reduce

When publishing with Native AOT the build OS and Architecture must match the target platform that the application will run. For AWS Lambda that target
platform is Amazon Linux 2023. The AWS tooling for Lambda like the AWS Toolkit for Visual Studio, .NET Global Tool Amazon.Lambda.Tools and SAM CLI will
perform a container build using a .NET 8 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
perform a container build using a .NET 10 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
when packaging .NET Native AOT Lambda functions on non-Amazon Linux 2023 build environments. To install docker go to https://www.docker.com/.

### Trimming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "AOT_Metrics",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AWSProjectType>Lambda</AWSProjectType>
Expand Down
2 changes: 1 addition & 1 deletion examples/AOT/AOT_Tracing/src/AOT_Tracing/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set to `true` to strip debugging symbols from the deployed executable to reduce

When publishing with Native AOT the build OS and Architecture must match the target platform that the application will run. For AWS Lambda that target
platform is Amazon Linux 2023. The AWS tooling for Lambda like the AWS Toolkit for Visual Studio, .NET Global Tool Amazon.Lambda.Tools and SAM CLI will
perform a container build using a .NET 8 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
perform a container build using a .NET 10 Amazon Linux 2023 build image when `PublishAot` is set to `true`. This means **docker is a requirement**
when packaging .NET Native AOT Lambda functions on non-Amazon Linux 2023 build environments. To install docker go to https://www.docker.com/.

### Trimming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "AOT_Tracing",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
Expand Down
2 changes: 1 addition & 1 deletion examples/BatchProcessing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To use the AWS SAM CLI, you need the following tools.
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)

You will need the following for local testing.
* .NET 8.0 - [Install .NET 8.0](https://www.microsoft.com/net/download)
* .NET 10.0 - [Install .NET 10.0](https://www.microsoft.com/net/download)

To build and deploy your application for the first time, run the following in your shell. Make sure the `template.yaml` file is in your current directory:

Expand Down
6 changes: 3 additions & 3 deletions examples/BatchProcessing/src/HelloWorld/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk@sha256:c8fdd06e430de9f4ddd066b475ea350d771f341b77dd5ff4c2fafa748e3f2ef2 AS build-image
FROM mcr.microsoft.com/dotnet/sdk@sha256:e1ffd2a92ae84c1291bc1b6887501f8af98e6331e7af6d4c8d37168c5e87a64c AS build-image

ARG FUNCTION_DIR="/build"
ARG SAM_BUILD_MODE="run"
Expand All @@ -13,9 +13,9 @@ RUN dotnet tool install -g Amazon.Lambda.Tools
# Build and Copy artifacts depending on build mode.
RUN mkdir -p build_artifacts
RUN if [ "$SAM_BUILD_MODE" = "debug" ]; then dotnet lambda package --configuration Debug; else dotnet lambda package --configuration Release; fi
RUN if [ "$SAM_BUILD_MODE" = "debug" ]; then cp -r /build/bin/Debug/net6.0/publish/* /build/build_artifacts; else cp -r /build/bin/Release/net6.0/publish/* /build/build_artifacts; fi
RUN if [ "$SAM_BUILD_MODE" = "debug" ]; then cp -r /build/bin/Debug/net10.0/publish/* /build/build_artifacts; else cp -r /build/bin/Release/net10.0/publish/* /build/build_artifacts; fi

FROM public.ecr.aws/lambda/dotnet@sha256:ec61a7f638e2a0c86d75204117cc7710bcdc70222ffc777e3fc1458287b09834
FROM public.ecr.aws/lambda/dotnet@sha256:6a4e0d15ca7b7fa6879155f5ceef7231a19ab099756a7e36090db2bf2fde281f

COPY --from=build-image /build/build_artifacts/ /var/task/
# Command can be overwritten by providing a different command in the template directly.
Expand Down
2 changes: 1 addition & 1 deletion examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/BatchProcessing/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Example project demoing the Batch Processing Utility in Powertools
Globals:
Function:
Timeout: 20
Runtime: dotnet8
Runtime: dotnet10
MemorySize: 1024
Environment:
Variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "BedrockAgentFunction"
Expand Down
2 changes: 1 addition & 1 deletion examples/Idempotency/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To use the AWS SAM CLI, you need the following tools.
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)

You will need the following for local testing.
* .NET 8.0 - [Install .NET 8.0](https://www.microsoft.com/net/download)
* .NET 10.0 - [Install .NET 10.0](https://www.microsoft.com/net/download)

To build and deploy your application for the first time, run the following in your shell. Make sure the `template.yaml` file is in your current directory:

Expand Down
2 changes: 1 addition & 1 deletion examples/Idempotency/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/Idempotency/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Runtime: dotnet6
Runtime: dotnet10
CodeUri: ./src/HelloWorld/
Handler: HelloWorld::HelloWorld.Function::FunctionHandler
MemorySize: 256
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.0" />
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Avro/src/Avro.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Avro/src/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ examples/Kafka/Avro/src/

## Prerequisites

- [Dotnet](https://dotnet.microsoft.com/en-us/download/dotnet) (dotnet8 or later)
- [Dotnet](https://dotnet.microsoft.com/en-us/download/dotnet) (dotnet10 or later)
- [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)
- [AWS CLI](https://aws.amazon.com/cli/)
- An AWS account with appropriate permissions
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Avro/src/aws-lambda-tools-defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "Avro.Example"
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Avro/src/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Globals:
Function:
Timeout: 15
MemorySize: 512
Runtime: dotnet8
Runtime: dotnet10

Resources:
AvroDeserializationFunction:
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Json/src/Json.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Json/src/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ examples/Kafka/Json/src/

## Prerequisites

- [Dotnet](https://dotnet.microsoft.com/en-us/download/dotnet) (dotnet8 or later)
- [Dotnet](https://dotnet.microsoft.com/en-us/download/dotnet) (dotnet10 or later)
- [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)
- [AWS CLI](https://aws.amazon.com/cli/)
- An AWS account with appropriate permissions
Expand Down
2 changes: 1 addition & 1 deletion examples/Kafka/Json/src/aws-lambda-tools-defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"function-runtime": "dotnet8",
"function-runtime": "dotnet10",
"function-memory-size": 512,
"function-timeout": 30,
"function-handler": "Json"
Expand Down
Loading