Microsoft Workloads on AWS

Why you should modernize legacy .NET applications on AWS (and how we can help)

Many organizations have legacy .NET Framework applications that they want to modernize to gain the agility, scalability, and cost savings of cloud-native technologies. One of the most effective ways to modernize .NET Framework applications is to move them to .NET on Linux runtimes, such as .NET Core on Linux or .NET 5.

Moving to Linux provides multiple benefits. Naturally, there’s the cost savings of no longer paying for a Windows license. Using the Linux ecosystem opens up a world of open-source tools and technologies that can help improve the efficiency and performance of your applications. For example, Linux containers help you take advantage of the latest serverless technologies, such as AWS Fargate and AWS Lambda. These technologies can take away the undifferentiated heavy lifting of managing servers and scaling your application up or down to meet customer demand. Additionally, AWS is the only major cloud provider that enables .NET 5 to run on a system based on the ARM64 architecture option. Couple this with AWS Graviton2 and customers get up to 40% better price performance over comparable current generation x86-based instances.

One of the more obvious benefits of moving your .NET Framework applications to .NET on Linux as opposed to another platform (like Node.js or Java) is that there’s more overlap in existing APIs and packages. While this reduces the effort required to re-write applications, it can still be taxing.

That’s why AWS launched the Porting Assistant for .NET in July 2020. Porting Assistant is a tool that helps you more quickly port your .NET applications to Linux. Porting Assistant for .NET quickly scans .NET Framework applications to identify incompatibilities with .NET Core and .NET 5, finds known replacements, and generates a detailed compatibility assessment.  We open sourced the porting assistant in October 2020 to invite community members to actively collaborate on porting .NET Framework applications to .NET Core.

In this blog, I explain why and how customers should think about modernizing their legacy .NET applications on AWS and the different modernization paths available. I also explore different AWS tools and services that can be used to modernize and run .NET applications, including Porting Assistant for .NET.

Overview of .NET modernization strategies

There are three main modernization paths for .NET applications: rehosting, replatforming and refactoring.

Decision Tree for migrating .NET Workloads

Figure 1: Decision Tree for migrating legacy .NET Workloads

You can use the decision tree to find the recommended migration or modernization path for your .NET legacy applications based on your requirements. You should also consider making this decision on an application-by-application evaluation, rather than an “all-in” approach. This may provide cost control and help you optimize quicker.

No matter what your business requirements are, AWS offers variety of services for your specific needs. You can directly migrate your legacy .NET applications to Windows instances on Amazon Elastic Compute Cloud (Amazon EC2) or AWS Elastic Beanstalk following ‘lift and shift’ approach for faster migration. If you don’t have access to source code or resources to refactor, you can replatform applications onto Windows containers with Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Kubernetes Service (Amazon EKS). And finally, you can reap the full benefits of the cloud by refactoring your code to .NET Core or .NET 5 and running it on serverless services or Linux containers.

Let’s dive deeper into each of these paths.

Rehost your legacy .NET applications

The quickest way to modernize is through “rehosting” or “lifting-and-shifting,” your applications. While organizations may want fully cloud-native applications, lifting-and-shifting can offer a quicker migration. By rehosting, you can move your legacy .NET applications (monolithic applications written in .NET Framework) from on premises to AWS without any code changes. For example, PennyMac chose to lift-and-shift their Windows workloads to achieve a fast migration before their datacenter lease expired.

You can choose to self-manage your applications or host your application on managed platforms. For customers that want full control over underlying virtual machine, storage and operating system patches, AWS offers Amazon Elastic Compute Cloud (Amazon EC2) instances with the required Windows OS version and instance size for your application’s unique needs. If you want to run your application on a managed service to ease your application administration, you can easily migrate to AWS Elastic Beanstalk, which is an easy-to-use service for deploying and scaling web applications and services. For a quick migration, you can use AWS’ Windows Web Application Migration Assistant  to migrate to AWS Elastic Beanstalk. We launched this open source interactive PowerShell utility last year. The service helps customers seamlessly migrate ASP.NET and ASP.NET Core web applications from IIS on Windows servers on premises or in another cloud to AWS Elastic Beanstalk. For more information on the tool, see this walkthrough blog.

Replatforming legacy .NET applications to Windows containers

While rehosting offers a quicker migration, customers also want to reap the additional benefits of cloud-native technologies. Replatforming legacy .NET Framework applications to containers helps to optimize operating system utilization and achieve runtime consistency. Containerizing also helps to leverage DevOps to develop and deploy faster. This is because you can build and operate using cloud-native tooling.

You can quickly containerize these applications to Windows containers with AWS App2Container (A2C) to take advantage of the elasticity and resilience of containers. A2C analyzes the running applications and automatically generates a container image with the correct dependencies, network configurations, and deployment instructions for running containers on AWS. A2C does not require source code to containerize applications, so you can even containerize third-party and Commercial off-the-shelf (COTS) applications. Here is the walkthrough blog and self-paced workshop to get you started on A2C.

Once you containerize these applications, you can self-manage and orchestrate the containers using Amazon EC2 to host Docker with Windows containers. You should choose to self-manage if you want full control and access over the underlying servers. However, if you want to offload management of underlying infrastructure to AWS, then you can run Windows container using Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Kubernetes Service (Amazon EKS). Amazon ECS and Amazon EKS are fully managed container orchestration services that allows you to focus on building and managing applications instead of underlying infrastructure.

Refactoring to .NET 5

We have seen that customers are already moving from .NET Framework to .NET Core on AWS to unlock cost savings and increased productivity. For example, GoDataFeed re-architected its monolithic .NET Framework legacy application using AWS Serverless running .NET Core. The company transformed its platform into a future-ready, cloud-native platform to take their business to the next level.

With the release of .NET 5, customers can benefit even more by porting .NET Framework applications to .NET 5 and running them on AWS. The .NET team has significantly improved performance with .NET 5 – including a 30% socket performance improvement on Linux. They have also made ARM64-specific optimizations in the .NET libraries that resulted in improving the speed and code size for ARM64 target, increasing .NET 5 performance specifically for ARM64.

So why is AWS best suited for running your .NET 5 workloads?

Running .NET 5 on Amazon EC2 with AWS Graviton2 Processor

If you want full control over an application’s underlying VM, operating system, storage, and patching, you can run .NET 5 applications on Amazon EC2 Linux instances of your choice. Amazon EC2 provides the broadest and deepest portfolio of compute instances, including many that are powered by latest-generation Intel and AMD processors. AWS Graviton2 processors based on the ARM64 architecture add even more choice to help customers optimize performance and cost for their workloads.

Comparing similar instance families, the Graviton2 instances are about 20% less expensive per hour than Intel x86 instances with up to 40% better performance. AWS Graviton2 helps customers running .NET realize ARM64 performance improvements with all .NET 5 Linux supported distributions (Alpine Linux, Debian, and Ubuntu). Follow the self-paced lab to get started on running .NET 5 web applications on AWS Graviton2.

If you have ported your application to .NET 5 and want to take advantage of running on Linux without managing the underlying Amazon EC2 Virtual Machine you can use AWS Elastic Beanstalk .NET 5 support on Linux platform.

Refactor to .NET 5 on Linux Containers

Customers may want to containerize applications to Linux containers to run applications on Linux servers and save Windows licensing costs. Containers allow applications to be more rapidly deployed, patched, or scaled. Containers support agile and DevOps efforts to accelerate development, test, and production cycles. For modernizing long-running tasks, you can refactor to .NET 5 microservices and containerize them to Linux containers. This helps customers take advantage of the performance, cost savings, and robust ecosystem of Linux. This comes with cost savings: as of April 2020, AWS customers can save up to 45% using Amazon EC2 instances running Amazon Linux as opposed to using Amazon EC2 instances running Windows.

Customers can run the containers securely, reliably and at scale using AWS Managed Services such as Amazon ECS and Amazon EKS with full support for Graviton2-based instances. If you want to self-manage containers, you can choose from supported Amazon EC2 instance types hosting Docker with Linux Container.

Serverless compute for .NET 5 applications

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers.  With Lambda, you can run code for virtually any type of application or backend service without any administration overhead. You can upload your code as a ZIP file or container image, and Lambda automatically and precisely allocates compute execution power and runs your code based on the incoming request or event, for any scale of traffic. Additionally, you only pay for the compute time you consume.

There are two options for the support for .NET 5 in Lambda. You can either build .NET 5 Lambda functions using Lambda container image support or you can target .NET 5 runtimes with AWS Lambda using a custom runtime. The Custom Runtime Function blueprint in the AWS Toolkit for Visual Studio has been updated to support .NET 5.

If a particular component in your application is a short-lived task that runs a specific trigger or schedule, it can be modernized by porting the .NET Framework code to .NET 5. Then, you can directly implement it as a serverless function using AWS Lambda.

While Lambda is better suited for event driven architectures, customers may want to run their longer running jobs as containerized applications in serverless fashion using AWS Fargate. Fargate is a serverless compute engine for containers that works with both Amazon ECS and Amazon EKS. Fargate allocates the right amount of compute, eliminating the need to choose instances and scale cluster capacity.

Getting started with modernizing your legacy .NET Framework Applications

To help customers port their application to .NET 5 faster, we added .NET 5 support to Porting Assistant for .NET. Porting Assistant is an analysis tool that scans .NET Framework applications to generate a target .NET Core or .NET 5 compatibility assessment. This makes it easy to prioritize applications for porting based on the level of effort required. It identifies incompatible APIs and packages from your .NET Framework applications, and finds known replacements. This reduces the manual effort of searching for replaceable packages and APIs. Because Porting assistant for .NET is open source, community members, including our solution partners, can add extensions to address customer needs.

To assess your legacy .NET application’s compatibility with .NET 5, you can check out the demo video on Porting Assistant for .NET. The video introduces the tool and showcases how to port a legacy.NET Framework Application to .NET 5.

Conclusion

Depending on which stage of cloud migration you’re in, you can choose from these different modernization paths for your legacy .NET applications. As you have seen, no matter whichever modernization path you choose, AWS offers tools to help accelerate and simplify your cloud journey.

Get in touch with us for any architectural discussion for modernizing your applications. Or why not, let AWS help you assess how your company can get the most out of cloud.

For .NET Developers looking to develop cloud native applications on AWS, check out our .NET on AWS Video playlist for guidance from AWS Solutions Architects on developing .NET applications. For more information on .NET on AWS, visit our .NET on AWS page.


AWS can help you assess how your company can get the most out of cloud. Join the millions of AWS customers that trust us to migrate and modernize their most important applications in the cloud. To learn more on modernizing Windows Server or SQL Server, visit Windows on AWS. Contact us to start your migration journey today.

Prasad Rao

Prasad Rao

Prasad Rao is a Principal Partner Solutions Architect at AWS based out of UK. His focus areas are .NET Application Modernization and Windows Workloads on AWS. He leverages his experience to help AWS Partners across EMEA for their long term technical enablement to build scalable architecture on AWS. He also mentors diverse people who are new to cloud and would like to get started on AWS.