.NET on AWS Blog
.NET 8 Support on AWS
James Eastham, Norm Johanson, and Ulili Nhaga contributed to this post.
Introduction
.NET 8 is the latest Long Term Support (LTS) version of cross-platform .NET, released in November 2023. .NET 8 includes performance improvements, container enhancements, C# language simplified syntax, Blazor support for full-stack web applications, and ASP.NET Core partial support for Native Ahead of Time compilation (Native AOT). In this post, I’ll review AWS compute services and tools that support .NET 8 and point you to developer resources.
If you’re running an older version of .NET, be aware that both .NET 7 and .NET 6 will reach end of support in 2024. Per Microsoft’s .NET support policy, support ends for .NET 7 on May 14th, 2024 and for .NET 6 on November 12th, 2024. .NET 8 will be supported through November 10, 2026.
Compute Services
Whether your workloads are self-managed, run in a managed service, use containers, or are serverless, you can use .NET 8 on AWS. You can run .NET 8 today on Amazon Elastic Compute Cloud (Amazon EC2), AWS Elastic Beanstalk, Amazon Elastic Container Service (Amazon ECS), Amazon Elastic Kubernetes Service (Amazon EKS), AWS App Runner, and AWS Lambda.
Amazon EC2
Amazon EC2 offers broad and deep compute functionality, with granular control for managing your infrastructure with a choice of processors, storage, and networking. Customers can install .NET 8 on over 400 instance types.
To install .NET 8 on an EC2 instance, specify User Data commands when launching the instance.
Instructions for installing .NET on Linux can be found at https://learn.microsoft.com/en-us/dotnet/core/install/linux#packages. Install scripts for .NET can be found at https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install.
You can use automation facilities in AWS Systems Manager service to automatically install .NET runtimes using automation documents, and use the EC2 Image Builder service to pre-create EC2 Images with the .NET Runtime pre-installed.
AWS Elastic Beanstalk
Elastic Beanstalk is a managed service that allows you to quickly deploy and manage applications in the AWS Cloud without having to learn about the infrastructure that runs those applications. Your EC2 assets are fully visible in your AWS account and you have full access to them.
As of the 12/05/2023 platform update, Elastic Beanstalk Windows supports .NET 8.
As of the 05/17/2024 platform update, Elastic Beanstalk Linux supports .NET 8 on AL2023. The 2023.4.20240513 AMI supports .NET 8.0.5.
AWS Lambda
AWS Lambda supports the .NET 8 runtime. In the AWS Lambda console, there’s now a runtime option for .NET 8 (C#/F#/PowerShell), shown in Figure 1. Refer to Introducing the .NET 8 runtime for AWS Lambda for complete information on creating and updating Lambda functions for .NET 8, and using Native AOT. You can also run .NET 8 applications on AWS Lambda in several other ways. You can create your own custom runtime, deploy a container, or publish native code to Lambda using .NET 8's Native AOT compilation.
Video: The Simplest Way To Build .NET 8 Native AOT Lambda Functions
Blog post: Building serverless .NET applications on AWS Lambda using .NET 7
The AWS .NET Lambda packages have been updated to target .NET 8 and address Native AOT warnings. This makes it easier and safer to use them for Native AOT Lambda functions.
The .NET Lambda Annotations Framework simplifies the programming model and lets you write .NET Lambda functions more naturally in C#. When using custom runtimes or native ahead of time (AOT) compilation, the framework removes the need to manually bootstrap the Lambda runtime and can auto-generate the Main method. See .NET Lambda Annotations Design - Auto Generate Main.
Containers
You can deploy .NET applications running on either Windows or Linux containers to Amazon Elastic Container Software (ECS) or Amazon Elastic Kubernetes Service (EKS). AWS Fargate is a service that you can use to run and manage the lifecycle of ECS and EKS containers without the need to manage the container infrastructure yourself.
AWS App Runner is a fully managed service that makes it easy to quickly deploy containerized web applications and APIs, scaling up or down automatically to meet application traffic needs. To use with .NET 8 applications, upload an image with the .NET 8 application to Amazon Elastic Container Registry (ECR) and use the source image support to configure AWS App Runner to start, run, scale, and load balance the application.
You can deploy a .NET 8 application to Elastic Beanstalk in a container. For more information, refer to Deploying Elastic Beanstalk applications from Docker containers.
Security and Diagnostics
AWS X-Ray
AWS X-Ray helps developers analyze and debug distributed applications, such as those built using a microservices architecture. .NET 8 applications can integrate AWS X-Ray with AWS X-Ray SDK for .NET and the AWS Distro for OpenTelemetry .NET. We don’t recommend using AWS X-Ray with Native AOT .NET applications at this time.
Tools, Libraries, and SDK
If you’ve been using an older version of .NET on AWS, be sure to update the AWS tools installed on your developer machine.
AWS SDK for .NET
The AWS SDK for .NET allows .NET developers to integrate AWS services into their application code in a familiar and consistent manner. Starting with version 3.7.300 the SDK added a new .NET 8 target framework and has made the SDK compatible with Native AOT by addressing all trimming warnings. The library is available from NuGet. Learn how to get started with the AWS SDK for .NET in the Developer Guide.
AWS Code Build
AWS Code Build is a fully managed service to help developers automatically build applications from source code. The code build service allows the user to customize the build environment, to suit the needs of the application being built. This includes the ability to install additional .NET runtimes. You can add support for building .NET 8 applications by adding the following snippet to their applications buildspec.yml file.
install:
commands:
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 8.0
This will automatically download and install the .NET 8 SDK as part of the Install phase of CodeBuild.
AWS Deploy Tool for .NET
The AWS Deploy Tool for .NET command line interface (CLI) is an interactive assistant that provides compute recommendations for .NET applications and deploys them to AWS in a few easy steps. The Deploy Tool supports .NET 8 applications by creating container images for container based services like Amazon ECS and AWS AppRunner or using .NET self-contained publishing for Elastic Beanstalk.
AWS Toolkit for Visual Studio
The AWS Toolkit for Visual Studio is an extension for Microsoft Visual Studio on Windows that makes it easier for developers to develop, debug, and deploy .NET applications using Amazon Web Services. Visual Studio 2022 supports .NET 8 development.
The Toolkit’s Publish to AWS feature integrates with the AWS Deploy Tool for .NET, and can deploy .NET 8 projects to various AWS services from Visual Studio. You can deploy ASP.NET Core projects to Amazon ECS, AWS App Runner, Elastic Beanstalk Windows, Elastic Beanstalk Linux, or the Amazon Elastic Container Registry (Amazon ECR).
You can download the AWS Toolkit for Visual Studio 2022 from the Visual Studio Marketplace. If you're already using the AWS Toolkit for Visual Studio, be sure to upgrade to the latest version by navigating to Manage Extensions > Updates in Visual Studio.
.NET Modernization Tools
AWS provides assistive tools that help architects, developers, and IT professionals modernize .NET workloads. The following AWS modernization tools now support .NET 8:
AWS App2Container (A2C) is a command line tool that containerizes your applications. It automatically generates a container image configured with the correct dependencies, network configurations, and deployment instructions for Amazon ECS or Amazon EKS. A2C can now detect a .NET 8 runtime version and containerize the application using the corresponding runtime base images.
AWS Microservice Extractor for .NET is an assistive tool that serves as an advisor to assess and visualize monolithic code, and recommend microservice candidates using artificial intelligence and heuristics. It also serves as a robotic builder to simplify microservices extraction. Microservice Extractor now supports analyzing .NET 8 applications for visualization, grouping, and extraction. With its integrated strangler-fig porting capability, you can also use Microservice Extractor to break down a large .NET Framework-based application with hundreds of projects and thousands of classes into manageable groups and port those directly to .NET 8.
Migration Hub Strategy Recommendations (MHSR) helps you plan migration and modernization initiatives by offering strategy recommendations for viable transformation paths for your applications. MHSR can now detect .NET 8 applications and provide recommendations for them.
AWS Toolkit for .NET Refactoring is a Visual Studio extension that helps you refactor legacy .NET applications to cloud-based alternatives on AWS. It provides a compatibility assessment report and helps port your code. The Toolkit for .NET Refactoring can now target .NET 8 for assessment, porting, and test deployment.
You can take full advantage of .NET 8 as you plan, migrate, and modernize .NET workloads on AWS using these assistive tools. For more information on .NET modernization use cases and tools, see Modernize .NET Workloads on AWS at the .NET on AWS developer center.
Conclusion
You can run .NET 8 workloads on AWS today across a spectrum of AWS compute services. The SDK for .NET, multiple developer tools, and multiple .NET modernization tools also support .NET 8. If you have existing AWS workloads on .NET 6 or .NET 7, be proactive in upgrading to .NET 8 before they reach end-of-support. You can keep up to date on .NET on AWS developments by visiting the AWS .NET development center.