Important Note: You will create AWS resources during the exercise which will incur cost in your AWS account. It is recommended to clean-up the resources as soon as you finish the exercise to minimize the cost.

Using AWS App2Container to modernize apps into containerized apps

AWS App2Container (A2C) is a tool to modernize existing applications into containerized applications. A2C helps to standardize the deployment and operations through containers. It works for all types of deployments - virtual machines, on-premises or in the cloud. A2C currently supports .NET and Java Applications.

In this exercise, you will containerize an ASP.NET web application deployed on Windows using A2C.

The AWS Resource consumption for the exercise does not fall under AWS Free Tier.

Step1: Pre-Requisite

You need to have an AWS account with administrative access to complete the exercise. If you don’t have an AWS account, kindly use the link to create free trial account for AWS.

Step2: What is available for the exercise?

In this exercise, you use A2C to containerize an ASP.NET application. In order to facilitate the exercise, AWS-Dojo has provided a public AMI (AMI ID: ami-049284c3cffa7c7e0 & AMI Name:aws-dojo-app2containerwebapp). You will launch an Amazon EC2 instance using this AMI and use A2C to containerize the sample ASP.NET application deployed on the EC2 instance.

This AMI has the following configuration -

  1. Windows 2016 Operating System

  2. Docker Installed (one of the prerequisite for A2C)

  3. AWS CLI 2.0 Installed (one of the prerequisite for A2C)

  4. App2Container installation package copied (one of the prerequisite for A2C)

  5. A sample ASP.NET application deployed (sample application to be containerized using A2C)

All set. Let’s get started.

Step3: Create S3 Bucket

The first step is to create the Amazon S3 bucket which is used to store deployment artifacts of the application containerization. When you try to deploy the containerized application to AWS, the S3 bucket is used.

  1. Login to the AWS Console and choose Ireland as the region.

  2. Goto S3 Management Console. Use + Create bucket button to create a new bucket dojo-a2c-bucket. If the bucket name is not available, then create a bucket with the name which is available.


  3. In the next step, create IAM User and generate keys (access, secret) which is used to run A2C commands to containerize the application.

Step4: Create IAM User

Let’s create an IAM user which is used to containerize the application using App2Container.

  1. Goto IAM Management Console, click on the Users menu in the left and then click on the Add user button.


  2. On the next screen, type in dojouser as the user name and select Programmatic access as the option for the access type. Click on the Next: Permissions button.


  3. On the next screen, select Attach existing policies directly option. Select AdministratorAccess as the policy and click on the Next: Tags button.


  4. On the next screen, click on the Next: Review button.

  5. On the next Review screen, click on the Create user button. It creates the user and it also generates Access key ID and Secret access key. Click on the Download.csv link to download the keys. Note: please make sure you download the keys as you need them in the later steps.


  6. The S3 bucket and IAM user account are ready. Let’s launch an EC2 instance where ASP.NET application is deployed. You will use App2Container commands on this EC2 instance to containerize the ASP.NET application.

Step5: Launch EC2 Instance

Launch the EC2 instance where all the actions will happen. You will use an AMI provided by AWS-Dojo to launch the instance.

  1. Goto EC2 Management console. Click on the AMIs in the left menu.


  2. In the AMIs screen, change the filter to Public images. Search for the public AMI where AMI Name is aws-dojo-app2containerwebapp. You will see AMI listed like below. Select the AMI and click on the Launch button.


  3. On the next screen, select t2.large as the instance type and click on the Next: Configure Instance Details button. You can select a larger or smaller instance if you want.


  4. On the next screen, select the default VPC for the network. Select Enable for the auto-assign public IP field. Keep rest of the configuration as it is and click on the Next: Add Storage button.


  5. On the next Add Storage screen, keep the configuration to the default and click on the Next: Add Tags button.

  6. On the next screen, add tag Name = DojoWebServer and click on the Next: Configure Security Group button.


  7. On the next screen, Select Create a new security group option and type in DojoRDPSecurityGroup for the security group name and description. Configure access for the RDP as shown below. Click on the Review and Launch button. For the exercise, you just need RDP (Remote Desktop) access to the EC2 instance.


  8. On the next Review Instance Launch screen, click on the Launch button. It will ask to create a new keypair in the popup window. Select Proceed without a keypair option. Check for the acknowledgement and click on the Launch Instances button.


  9. It will start the instance launch process. Wait till instance is ready (When status check = 2/2). RDP to the EC2 instance using the public IP. The user name is Administrator and the password is Password1!.


  10. It is all good if your RDP is successful and you are connected through the RDP session.


  11. In the RDP session, open internet explorer and browse http://localhost/dojowebapp/. This is the sample ASP.NET application deployed on Internet Information Server (IIS) which you will containerize using App2Container.


  12. Stay in the RDP session as you will start working with the App2Container installation and configuration in the EC2 instance as the next step.

Step6: Install and Configure A2C

Let’s move to the core of the exercise. You will first configure AWS Default Profile using dojouser security keys. You then install and configure App2Container on the EC2 instance.

  1. In the RDP session, start Windows Powershell for AWS console and run the command aws configure. During configuration, provide the access key id and secret access key for the dojouser. You got these keys in one of the previous steps. Type in eu-west-1 for the region and json for the output format. It will create AWS Default Profile on the EC2 instance which is used by the App2Container to perform various actions in the AWS account.


  2. In the RDP session, close the Windows Powershell for AWS console. Goto the C:\download folder. You already have App2Container installation package for the windows copied there. Alternative - you can download the installation package from the link.


  3. Extract the App2Container installation package in the C:\download\AWSApp2Container-installer-windows folder.


  4. In the RDP session, close the folder. Open Windows Powershell console and navigate to the folder C:\download\AWSApp2Container-installer-windows.


  5. In the Windows Powershell console, run the command .\install.ps1 to install App2Container.


  6. It completed the installation of the App2Container package. Now you need to configure it. In the Windows Powershell console, run the command app2container init. Select the default configuration for all the settings. For the bucket configuration, type in dojo-a2c-bucket. If you created a bucket with a different name then use that one.


  7. The App2Container installation and configuration is complete. It is ready for the use. The important aspects of the configuration is - a) A2C will use AWS Default Profile b) The containerization artifacts are stored locally at C:\Users\Administrator\AppData\Local\app2container folder and c) The deployment artifacts are stored in dojo-a2c-bucket during deployment.

  8. Stay in the Windows Powershell console. The next step is to start running the containerization commands.

Step7: Containerize the ASP.NET Application

In this step, you will use App2Container to identify the applications deployed on the EC2 instance and then run commands to containerize the specific application.

  1. In the RDP session, goto Windows Powershell console. Run the command app2container inventory to list the application inventory on the EC2 instance. You can see dojowebapp deployed in iis default web site. You just browsed the application in one of the previous steps. You will containerize this application. Make note of the app id iis-default-web-site-a7b69c34 for the dojowebapp application.


  2. In the Windows Powershell console, run the command app2container analyze –application-id iis-default-web-site-a7b69c34 to analyze the dojowebapp for the containerization.The command will take a while to complete.


  3. The analyze command will take a while to complete. The analysis file analysis.json is copied at the workspace folder C:\Users\Administrator\AppData\Local\app2container\iis-default-web-site-a7b69c34. It is recommended to look at the file to check the application configuration (operating system, application details, ports, features etc.) for the containerization.


  4. In the Windows Powershell console, run the command app2container containerize –application-id iis-default-web-site-a7b69c34 to create set of deployment artifacts for the application containerization. The command will take quite a sometime to complete.


  5. The containerization artifacts (deployment files) for the application is created at the workspace folder C:\Users\Administrator\AppData\Local\app2container\iis-default-web-site-a7b69c34\Artifacts. Please navigate through the deployment files in the folder. You can see the docker file and the resources for the web application deployment.


  6. You can also run the docker images command in the Windows Powershell console to see the list of the images. You can see a docker image created the ASP.NET application.


  7. At this point of time, you are all set to deploy the web application to the container platform of your choice - ECS or EKS on AWS.

  8. You can use app2container generate app-deployment command to complete the deployment. The command will create the set of resources at AWS and then deploy the application using the deployment artifacts. The exercise is not deploying to keep the cost of the exercise low. But if you are interested, you can continue with the final deployment. Kindly refer the link for the details about deployment command.

  9. It finishes the exercise. Kindly follow the next step to clean-up the resources so that you don’t incur any cost post the exercise.

Step8: Clean up

Delete dojouser IAM User.

Delete dojo-a2c-bucket S3 Bucket.

Delete DojoWebServer EC2 instance.

Thanks and hope you enjoyed the exercise.

Back to the Exercises