Organizations goal to ship optimum technological options based mostly on their clients’ wants. Though they could be at any stage of their cloud adoption journey, companies usually find yourself managing and constructing monolithic purposes. Nevertheless, there are various challenges to this answer. The inner construction of a monolithic utility makes it troublesome for builders to take care of code. This creates a steep studying curve for brand new builders and will increase prices. Monoliths require a number of groups to coordinate a single massive launch, which will increase the collaboration and information switch burden. As a enterprise grows, a monolithic utility could battle to fulfill the calls for of an increasing consumer base. To handle these considerations, clients ought to consider their readiness to modernize their purposes within the AWS Cloud to fulfill their enterprise and technical wants.
We are going to talk about an strategy to modernizing a monolithic three-tier utility (MVC sample): an online tier, an utility tier utilizing a .NET Framework, and a knowledge tier with a Microsoft SQL (MSSQL) Server relational database. There are three important modernization pathways for .NET purposes: rehosting, replatforming, and refactoring. We advocate following this determination matrix to evaluate and determine in your migration path, based mostly in your particular necessities. For this weblog, we are going to concentrate on a replatform and refactor technique to design loosely coupled microservices, packaged as light-weight containers, and backed by a purpose-built database.
Your modernization journey
The outcomes of your group’s strategy to modernization offers you the power to scale optimally along with your clients’ calls for. Let’s dive right into a guided strategy that achieves your objectives of a contemporary structure, and on the similar time addresses scalability, ease of upkeep, speedy deployment cycles, and value optimization.
This includes 4 steps:
- Break down the monolith
- Containerize your utility
- Refactor to .NET 6
- Migrate to a purpose-built, lower-cost database engine.
1. Break down the monolith
Migration to the Amazon Net Providers (AWS) Cloud has many benefits. These can embody elevated velocity to market and enterprise agility, new income alternatives, and value financial savings. To take full benefit, you need to constantly modernize your group’s purposes by refactoring your monolithic purposes into microservices.
Decomposing a monolithic utility into microservices presents technical challenges that require a strong understanding of the present code base and context of the enterprise domains. A number of patterns are helpful to incrementally remodel a monolithic utility into microservices and different distributed designs. Nevertheless, the method of refactoring the code base is handbook, dangerous, and time consuming.
To assist builders speed up the transformation, AWS launched AWS Microservice Extractor for .NET. This helps breakdown architecting and refactoring purposes into smaller code tasks. Learn how AWS Microservice Extractor for .NET helped our accomplice, Kloia, speed up the modernization journey of their clients and decompose a monolith.
The following modernization pathway is to containerize your utility.
2. Containerize
Why must you transfer to containers? Containers provide a manner that will help you construct, check, deploy, and redeploy purposes on a number of environments. Particularly, Docker Containers give you a dependable method to collect your utility elements and package deal them collectively into one construct artifact. That is essential as a result of fashionable purposes are sometimes composed of quite a lot of items in addition to code, reminiscent of dependencies, binaries, or system libraries. Shifting legacy .NET Framework purposes to containers helps to optimize working system utilization and obtain runtime consistency.
To speed up this course of, containerize these purposes to Home windows containers with AWS App2Container (A2C). A2C is a command line device for modernizing .NET and java purposes into containerized purposes. A2C analyzes and builds a list of all purposes operating in digital machines, on-premises, or within the cloud. Choose the appliance that you just wish to containerize and A2C packages the appliance artifact and recognized dependencies into container photographs. Here’s a step-by-step article and self-paced workshop to get you began utilizing A2C.
As soon as your app is containerized, you’ll be able to select to self-manage through the use of Amazon EC2 to host Docker with Home windows containers. You can too use Amazon Elastic Container Service (ECS) or Amazon Elastic Kubernetes Service (Amazon EKS). These are totally managed container orchestration providers that frees you to concentrate on constructing and managing purposes as an alternative of your underlying infrastructure. Learn Amazon ECS vs Amazon EKS: making sense of AWS container providers.
Within the subsequent part, we’ll talk about two major facets to optimizing prices in our modernization state of affairs:
- Licensing prices of operating workloads on Home windows servers.
- SQL Server licensing value.
3. Refactor to .NET 6
To handle Home windows licensing prices, take into account shifting to a Linux atmosphere by adopting .NET Core and utilizing the Dockerfile for a Linux Container. Clients reminiscent of GoDataFeed profit by porting .NET Framework purposes to more moderen .NET 6 and operating them on AWS. The .NET workforce has considerably improved efficiency with .NET 6, together with a 30–40% socket efficiency enchancment on Linux. They’ve added ARM64-specific optimizations within the .NET libraries, which allow clients to run on AWS Graviton.
You might also select to change to a serverless possibility utilizing AWS Lambda (which helps .NET 6 runtime), or run your containers on ECS with Fargate, a serverless, pay-as-you-go compute engine. AWS Fargate powered by AWS Graviton2 processors can scale back value by as much as 20%, and improve efficiency by as much as 40% versus x86 Intel-based situations. For those who want full management over an utility’s underlying digital machine (VM), working system, storage, and patching, run .NET 6 purposes on Amazon EC2 Linux situations. These are powered by the latest-generation Intel and AMD processors.
To assist clients port their utility to .NET 6 sooner, AWS added .NET 6 assist to Porting Assistant for .NET. Porting Assistant is an evaluation device that scans .NET Framework (3.5+) purposes to generate a goal .NET Core or .NET 6 compatibility evaluation. This lets you prioritize purposes for porting based mostly on effort required. It identifies incompatible APIs and packages out of your .NET Framework purposes, and finds recognized replacements. You may discuss with a demo video that explains this course of.
4. Migrate from SQL Server to a lower-cost database engine
AWS advocates that you just construct use case-driven, extremely scalable, distributed purposes suited to your particular wants. From a database perspective, AWS provides 15+ purpose-built engines to assist numerous information fashions. Moreover, microservices architectures make use of unfastened coupling, so every particular person microservice can independently retailer and retrieve info from its personal information retailer. By deploying the database-per-service sample, you’ll be able to select essentially the most optimum information shops (relational or non-relational databases) to your utility and enterprise necessities.
For the aim of this weblog, we are going to concentrate on a relational database alternate for SQL Server. To handle the SQL Server licensing prices, clients can take into account a transfer to an open-source relational database engine. Amazon Relational Database Service (Amazon RDS) helps MySQL, MariaDB, and PostgreSQL. We are going to concentrate on PostgreSQL with a well-defined migration path. Amazon RDS helps two sorts of Postgres databases: Amazon RDS for PostgreSQL and Amazon Aurora PostgreSQL-Suitable Version. That will help you select, learn Is Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL a more sensible choice for me?
When you’ve selected the Amazon RDS taste, the subsequent query could be “what’s the correct migration technique for me?” Contemplate the next:
- Convert your schema
- Migrate the information
- Refactor your utility
Schema conversion
AWS Schema Conversion Device (SCT) is a free device that may make it easier to convert your current database from one engine to a different. AWS SCT helps numerous supply databases, together with Microsoft SQL Server, Oracle, and MySQL. You may select from goal database engines reminiscent of Amazon Aurora PostgreSQL-Suitable Version, or select to arrange a knowledge lake utilizing Amazon S3. AWS SCT gives a graphical consumer interface that instantly connects to the supply and goal databases to fetch the present schema objects. When related, you’ll be able to generate a database migration evaluation report back to get a high-level abstract of the conversion effort and motion gadgets.
Knowledge migration
When the schema migration is full, you’ll be able to transfer your information from the supply database to the goal database. Relying in your utility availability necessities, you’ll be able to run an easy extraction job that performs a one-time copy of the supply information into the brand new database. Or, you should utilize a device that copies the present information and continues to duplicate all adjustments till you might be prepared to chop over to the brand new database. One such device is AWS Database Migration Service (AWS DMS) that helps you migrate relational databases, information warehouses, NoSQL databases, and different sorts of information shops.
With AWS DMS, you’ll be able to carry out one-time migrations, and you may replicate ongoing adjustments to maintain sources and targets in sync. When the supply and goal databases are in sync, you’ll be able to take your database offline and transfer your operations to the goal database. Learn Microsoft SQL Server To Amazon Aurora with PostgreSQL Compatibility for a playbook or use this self-guided workshop emigrate to a PostgreSQL suitable database utilizing SCT and DMS.
Software refactoring
Every database engine has its variations and nuances, and shifting to a brand new database engine reminiscent of PostgreSQL from MSSQL Server would require code refactoring. After the preliminary database migration is accomplished, manually rewriting utility code, switching out database drivers, and verifying that the appliance habits hasn’t modified requires vital effort. This includes potential threat of errors when making intensive adjustments to the appliance code.
AWS constructed Babelfish for Aurora PostgreSQL to simplify migrating purposes from SQL Server to Amazon Aurora PostgreSQL-Suitable Version. Babelfish for Aurora PostgreSQL is a brand new functionality for Amazon Aurora PostgreSQL-Suitable Version that allows Aurora to grasp instructions from purposes written for Microsoft SQL Server. With Babelfish, Aurora PostgreSQL now understands T-SQL, Microsoft SQL Server’s proprietary SQL dialect. It helps the identical communications protocol, so your apps that had been initially written for SQL Server can now work with Aurora. Examine the way to migrate from SQL Server to Babelfish for Aurora PostgreSQL. Be sure you run the Babelfish Compass device to find out whether or not the appliance accommodates any SQL options not at present supported by Babelfish.
Determine 1 exhibits the earlier than and after state to your utility based mostly on the modernization path described on this weblog. The applying tier consists of microservices operating on Amazon ECS Fargate clusters (or AWS Lambda capabilities), and the information tier runs on Amazon Aurora (PostgreSQL taste).

Determine 1. A modernized microservices-based rearchitecture
Abstract
On this put up, we confirmed a migration path for a monolithic .NET Framework utility to a contemporary microservices-based stack on AWS. We mentioned AWS instruments to interrupt the monolith into microservices, and containerize the appliance. We additionally mentioned value optimization methods by shifting to Linux-based programs, and utilizing open-source database engines. For those who’d prefer to know extra about modernization methods, learn this prescriptive information.