-
Notifications
You must be signed in to change notification settings - Fork 36
chore(examples): migrate examples and docs to .NET 10 #1267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nicolastarzia
wants to merge
2
commits into
aws-powertools:develop
Choose a base branch
from
nicolastarzia:chore/migrate-examples-dotnet10
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| --- | ||
|
|
||
| # 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/AOT/AOT_Logging/test/AOT_Logging.Tests/AOT_Logging.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/AOT/AOT_Metrics/test/AOT_Metrics.Tests/AOT_Metrics.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/AOT/AOT_Tracing/test/AOT_Tracing.Tests/AOT_Tracing.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/Event Handler/BedrockAgentFunction/src/BedrockAgentFunction.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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