Hello, App2Container!

Hello, App2Container!

This episode: AWS App2Container and containerizing .NET Framework applications. In this Hello, Cloud blog series, we're covering the basics of AWS cloud services for newcomers who are .NET developers. If you love C# but are new to AWS, or to this particular tool, this should give you a jumpstart.

In this post we'll introduce AWS App2Container and easy migration of .NET Framework applications to cloud using Windows containers.

App2Container : What is it, and why use It?

"Every seed destroys its container or else there would be no fruition." —Florida Scott-Maxwell

Many enterprises have on-premise legacy applications that are overdue for migration to cloud and modernization. For .NET Framework applications, containerizing and migrating to cloud is a good first step toward modernization.

AWS App2Container (hereafter "A2C") is a tool that containerizes both .NET and Java web applications. AWS describes it a "a command line tool for migrating and modernizing ... web applications into container format". With A2C, you can easily migrate .NET Framework, modern .NET, or Java web apps to AWS without code changes. In this post we'll be focusing on .NET Framework apps.

Windows Containers

A2C can containerize your .NET Framework IIS web applications using Windows containers. Many developers are famiiar with Docker containers that run on Linux hosts. Windows containers are the same idea, but run on Windows Server hosts.

A2C handles end-to-end containerizing and deployment of your IIS apps to AWS. It creates a Windows container image of your .NET Framework application, and deploys a service running Windows containers to AWS. You can deploy to Amazon Elastic Container Service (Amazon ECS) or, if you prefer Kubernetes, Amazon Elastic Kubernetes Service (EKS). When you deploy to ECS, you have the option of using AWS Fargate to host containers serverelessly.

App2Container Process

A2C has a 4-step process. You issue A2C commands to advance through each step. The diagram shows how this works with a .NET framework app, Windows containers, and ECS.

  1. Discover & Analyze: create an application inventory of your ASP.NET appliations and analyze runtime dependenceis.

  2. Extract & Containerize: extract an application with dependencies and create a Docker image.

  3. Create Deployment Artifacts: Generate the Amazon ECS or Kubernetes pod definitions, and create CI/CD pipelines.

  4. Deploy to AWS: Store the image in Amazon Elastic Container Registry (ECR), and deploy seamlessly to Amazon ECS or Amazon EKS.

Workshops & Tutorials

A good way to prepare for working with A2C is to take a tutorial. I recommend you take the AWS Modernize with AWS App2Container Workshop or watch the video tutorial, How to containerize a .NET application into Amazon ECS using AWS App2Container (A2C). The workshop is detailed and migrates an ASP.NET web application with A2C as well as migrating its SQL Server database to Amazon RDS. It might take as long as 4 hours and cost you about $10 in AWS charges, but you'll gain proficiency.

App2Container Walk-through

Here's a walkthough of how to use App2Container. Review the documentation before trying this yourself, which covers some different options you'll want to consider, including using a worker machine.

Step 1: Installation

Before attempting to use A2C, you need to meet some prerequisites and set up your servers. That includes signing up for AWS, granting permissions to run A2C commands, configuring an AWS profile, and installing Docker. Confirm your application(s) are A2C supported applications. For example, ASP.NET applications deployed on IIS, including IIS-hosted WCF applications, running on various editions of Windows Server.

With prerequisites out of the way, you can install App2Container on your server by downloading a zip archive with a PowerShell script that installs App2Container.

PS> .\install.ps1

Step 2: Initialization

The first command you should run with A2C is app2container init to perform one-time initialization. You'll be promoted for the information needed to set up a local App2Container environment, including a local working directory and an optional AWS S3 bucket to holkd containerization artifacts. You can also give optional consent for App2Container to collect and export metrics to AWS each time you run it.

Step 3: Analyze your application

Now you're ready to analyze your applications. This starts with an inventory of appilcations, after which you analyze specific applications one by one.

A2C scans your application servers to discover applications it can containerize and migrate to AWS. You use the app2container inventory command to list the ASP.NET aplications running on a server. The output

You can then run app2container analyze --application-id iis-app-id against any of the application IDs. The file analysis.json is created, which contains application information and container settings you can modify. For .NET apps, A2C also detects connection strings and identifies the changes needed in app config files to connect to new database endpoints in the cloud. That information is stored in a second file. report.txt.

Step 4: Containerize your app

With your app analyzed, you can now run app2container containerize to containerize the application and create a container image. For a .NET Framework app, that will be a Windows container image.

Step 5: Deploy to AWS

With your app containerized, you can deploy to AWS. You use the app2container generate app-deployment command to 1) upload your container to the Amazon Elastic Container Registry (ECR) and 2) generate deployment configuration files.

If you add the --deploy option to the command, A2C will 3) deploy your application to Amazon ECS or Amazon EKS for you.

Where To Go From Here

It's a container world now. Containers offer an easy way to make your applications portable and migrate to cloud. In this post, you learned about AWS App2Container, a command line tool that can containerize your .NET Framework applications and deploy them to Windows containers on AWS. Although our focus today was .NET Framework apps and Windows containers, you can also use A2C to containerize modern .NET apps and Java apps on AWS in Linux containers.

To learn more about A2C, review the resources below.

Further Reading

AWS Documentation

AWS App2Container

AWS App2Container User Guide

Infographic: AWS App2ontainer

Modernize with AWS App2Container Workshop

Blogs

Accelerate containerization and migration of ASP.NET Core applications to AWS using AWS App2Container by Pavankumar Kasani and Prasad Rao

Videos

How to containerize a .NET application into Amazon ECS using AWS App2Container (A2C) by Saleha Haider

Other

Hello Cloud home

Modernize .NET Workloads on AWS on the .NET on AWS developer hub