Migrating .NET applications
Migrating your .NET applications to AWS enables you to create highly available workloads with elastic scaling capabilities, reduce operation overhead, and increase your business agility by focusing on your differentiating value.
This section focuses on the different options for hosting your .NET applications on
AWS. You can choose between using a VM, a managed solution such as AWS Elastic Beanstalk
Assess
Choosing a migration path for your .NET workload relies on the following key factors:
-
Find the .NET version used – There are two different .NET implementations supported by Microsoft: .NET Framework (1.0–4.8) and .NET (.NET Core 1.0–3.1 and .NET 5 and later). Both share many of the same components and can run application code written using the different .NET programming languages (such as C#, F#, and VB.NET). Choosing a migration strategy and hosting service depends on the runtime used since .NET Framework runs on Windows while the newer .NET is multi-platform. For the .NET Framework, you can either host on a Windows OS or refactor your code to use the newer .NET. The newer .NET can also be hosted on Linux OS-based services. When modernizing .NET Framework-based workloads, you can use Porting Assistant for .NET
or the AWS Toolkit for .NET Refactoring to scan your code and generate a compatibility assessment report. By finding if there are incompatible .NET Framework APIs referenced by your project, you can plan for the complexity of a migration project and decide if and when to refactor your code to use a newer runtime. -
Review your current deployment – Check if the currently migrated workload has existing CI/CD pipelines that can be updated to deploy the same workloads to the cloud. Using an existing build and deploy pipeline can reduce the time it takes to deploy your application to the cloud by automating the steps necessary for building, configuring, and deploying your workloads.
-
Review your roadmap – Depending on the current state of the project, you might already be planning to rearchitect or redesign your applications. Any modernization performed should take the product roadmap into consideration. For example, deciding to containerize existing code or refactoring a monolithic architecture into microservices is ideally part of the product roadmap and aligned with other development efforts.
Mobilize
There are three different migration paths to consider when migrating your .NET workloads to AWS. You can choose between the different options depending on the complexity of your existing codebase, time allocated for migration, and the size of the team allocated to support the migration effort. When considering modernization as part of your migration, it's a best practice to be aligned with the product's roadmap.
-
Rehost (lift & shift) – You may choose this approach if your priority is faster migration to AWS with little to no changes. You can rehost ASP.NET-based websites to Internet Information Services (IIS) running on Amazon EC2 instances. You can rehost your desktop-based applications (such as Windows Presentation Foundation, Web Forms, and .NET MAUI) to one of the end user computing platforms such as Amazon AppStream 2.0
or Amazon WorkSpaces . -
Replatform – Replatforming is best suited for when you want to host your application using a managed service without making code changes but want to reduce your operational overhead by offloading undifferentiated heavy lifting such as installation, patching, upgrades, and instance management. This strategy is also suited for teams who want to move to container-based workloads. You can replatform your existing applications to Elastic Beanstalk
, or use Docker containers hosted on Amazon ECS , Amazon EKS , or AWS App Runner . -
Refactor – Choose this approach if you can invest time and effort into making code and architecture changes that reduce operational overhead and achieve better scaling, high availability, and disaster recovery by using AWS cloud-native services. Refactoring involves modernizing your codebase by porting existing .NET framework applications to .NET (previously .NET Core) or modernizing an existing codebase to run better in the cloud. You can use the AWS SDK for .NET
to call many AWS cloud services from within your .NET code. Tools such as Porting Assistant for .NET and AWS Microservice Extractor for .NET can be used to port your codebase from .NET Framework to .NET and break your monolithic application into microservices. By refactoring your existing .NET workloads to run on AWS Lambda , you can use serverless computing to avoid provisioning and managing infrastructure.
Migrate
The steps of your .NET workloads migration depend on the migration path that you chose during the assess stage and your type of application.
Rehost .NET applications
Choose this migration path if you want to migrate your application without making any code changes but want to benefit from automatic scaling, load balancing, and elasticity in the cloud. For Windows-based websites, rehosting usually means running them on Internet Information Services (IIS) on AWS. For desktop-based applications, you must install the application and enable users to connect to the application from outside.
Internet Information Services on AWS
Internet Information Services (IIS) is a Microsoft web server that runs on a Windows operating system and is used to host websites and web services. IIS can be installed on any Amazon EC2 instance running Windows Server. After IIS is enabled and configured, you can deploy your ASP.NET websites and services by using the same deployment mechanism that you use for on-premises environments.
If you host IIS on EC2 Windows instances, it's important to follow the AWS Well-Architected
Framework
Hosting desktop applications on AWS
Many clients have the need to access Windows based thick client applications. You have the choice between three different platforms:
-
Amazon EC2
– Choose this option if you want your users to connect to a Windows Server-based environment by using Microsoft Remote Desktop. With this option you're responsible for patching and maintaining your operating system. You must also purchase additional Remote Desktop Services client access licenses (RDS CALs) for your users and active Software Assurance (SA) . For more information, see Microsoft Licensing on AWS in the AWS documentation. -
Amazon WorkSpaces
– Choose this option if you need a fully managed virtual desktop infrastructure (VDI) for your users. You can use WorkSpaces to provide a persistent Windows Desktop experience to your users. You can also customize your WorkSpaces environment and install .NET applications by using a custom image, or use AWS Systems Manager to deliver your .NET applications to your WorkSpaces environments. Users can connect either by using their browser or the Amazon WorkSpaces client . -
Amazon AppStream 2.0
– Choose this option to provide secure, reliable, and scalable access to applications and non-persistent desktops from any location. You can use AppStream 2.0 to enable your users to access your .NET applications from the web. If you already have existing RDS CALs and active SA, then you can use those licenses with AppStream 2.0 by using License Mobility .
Replatform
Replatforming involves changing your hosting environment with little to no code changes. Choose this strategy to reduce your operational overhead and take advantage of cloud capabilities and services.
AWS Elastic Beanstalk
You can use AWS Elastic Beanstalk
To learn more, see the following resources:
-
Creating and deploying .NET applications on Elastic Beanstalk (Elastic Beanstalk documentation)
-
Working with .NET Core on Linux (Elastic Beanstalk documentation)
-
Multi-App Support with Custom Domains for .NET and AWS Elastic Beanstalk
(AWS Developer Tools Blog)
Containerize existing applications
You can use Amazon ECS or Amazon EKS to host your Docker-based containerized applications. AWS manages both services. The choice between the two depends on existing knowledge and preference. Both options can run either Linux-based containers or Windows-based containers.
To learn more, see the following resources:
-
Amazon EC2 Windows containers (Amazon ECS documentation)
-
Enabling Windows support for your Amazon EKS cluster (Amazon EKS documentation)
-
Running Windows Containers with Amazon ECS on AWS Fargate
(AWS Blog) -
Speeding up Windows container launch times with EC2 Image builder and image cache strategy
(AWS Blog) -
Quick start: CI/CD for .NET Applications on AWS Fargate
(AWS documentation)
Containerizing .NET based applications depends on the .NET runtime used. Consider the following:
-
.NET Framework-based applications run on Windows containers – Adding Docker support to existing applications is done by creating a Docker file that outlines how the application needs to be containerized. You can use AWS App2Container
to easily containerize and migrate existing .NET Framework-based applications to AWS. App2Container scans your IIS server to determine the required files and extracts the target application to create a Docker image. You can also use App2Container to create the deployment artifacts needed to host your application in the AWS Cloud. -
.NET or .NET Core – In addition to running newer .NET-based web applications on Amazon ECS or Amazon EKS, you can also use AWS App Runner
. App Runner is a serverless, fully managed solution that runs your code or container image and manages load balancing, auto scaling, logging, certificates, and networking.
Refactor/re-architect existing code
Choose this option if you have a strong business need to add features, scale, or performance that's otherwise difficult to achieve in the application's current environment. Depending on your application roadmap you can choose to change your code to use the latest framework, cloud-native services, or re-architect it to better run in the cloud.
The first refactoring option available is to migrate your existing .NET Framework application to .NET. The move to .NET gives you the benefit of running on Linux instead of Windows. This reduces your total licensing cost, gives you the latest frameworks, and offers the newest versions of the .NET programming languages.
AWS SDK for .NET
AWS SDK for .NET
Modernize .NET Framework applications
You can migrate from the .NET Framework by using Porting Assistant for .NET
Monolith to microservices
Many development teams want to re-architect their existing monolithic
applications into microservices. By moving to microservice-based architectures,
your development teams can increase development agility, decrease compute costs,
scale services individually, and decrease their deployment times. AWS Microservice Extractor for .NET
Refactor to serverless applications
AWS Lambda
Additional resources
-
Amazon CodeCatalyst
(CodeCatalyst documentation) -
AWS Toolkit for Azure DevOps
(AWS documentation) -
Setting up a CI/CD pipeline by integrating Jenkins with AWS CodeBuild and AWS CodeDeploy
(AWS DevOps Blog) -
About the AWS Deploy Tool for .NET
(AWS GitHub) -
.NET on AWS
(AWS documentation) -
aws/dotnet
(GitHub)