AWS Cloud Operations Blog
Accelerated Transformation: Streamline Application Modernization During Migration
Introduction
Application modernization involves discovery, analysis, extraction, containerization and deployment of an application migrated to AWS. The AWS Application Migration Service (AWS MGN) simplifies and expedites your migration to AWS by automatically converting your source servers from physical, virtual, or other cloud infrastructure to run natively on AWS. In this post, I use post-launch actions in AWS MGN to containerize your application by deploying it to the Amazon Elastic Container Service (Amazon ECS). This blog post provides operators who are migrating and modernizing their applications to Amazon ECS a step-by-step article for application replatforming using the AWS MGN post-launch action: App2Container for Replatforming.
Modernizations typically require access to source code, but AWS App2Container replatforming supports containerization of applications without changing or needing access to the application source code. AWS App2Container helps operators modernize .NET Framework, .NET, and Java applications running in a VM or on-premises server.
Prerequisites
The following are prerequisites to follow along with this blog:
- Access to the AWS Management Console with an active AWS Account.
- Basic understanding of container technology.
- Basic understanding of AWS MGN.
Walkthrough
With the introduction of App2Container for Replatforming (Powered by AWS App2Container) post-launch action in AWS MGN, operators can now containerize their application as part of the migration process to AWS. This saves time and effort from manually running every step without AWS MGN and allows you to test applications with the push of a button. This new post-launch action, which is available under the global post-launch template or individual server post-launch settings, discovers and analyzes applications ready for replatforming. The stages of application modernization are:
- Discovery – App2Container searches for supported applications in the target server.
- Analysis – App2Container analyzes each application discovered in the previous stage. Each application gets an analysis report that describe the application, target base image, required dependencies, and settings.
- Extraction – The extraction takes the application binary, supported packages, and creates a zipped file of the extracted artifacts.
- Containerization – Uses Docker with the target base image and the application zip file to create a Docker image that is stored in Amazon Elastic Container Registry (Amazon ECR).
- Deployment – Provides the operator with AWS CloudFormation artifacts required to deploy the containerized application.
Once the server migration is completed, the post-launch activities are initiated per server. To set post-launch activities from AWS MGN’s post-launch template enter App2Container in the Actions search bar as shown in Figure 1. In the search results, choose the App2Container for Replatforming tile.
Once the tile is selected, enter the information for the role used to modernize your applications, specify the instance ID from your launched instance, preferred location for the modernization process output, and the encryption settings for the information stored in the Amazon Simple Storage Service (Amazon S3) bucket. To make these changes, select Edit near the Actions menu bar.
For the AutomationAssumeRole parameter you will need to place an ARN Role that includes the following policy as outlined in the section: App2Container Automation runbook – To create the policy for the IAM role used by your instance in the AWS App2Container User Guide. You must create the policy first, name it ApplicationTransformationAnalyzerPolicy, and attach it to a role of your choice.
For InstanceId, select the option: Use value: Launched EC2 InstanceId.
The logs and artifacts created by the automation post-launch action are placed in the specified Amazon S3 bucket. The Amazon S3 bucket name under which the artifacts are placed will have the prefix: application-transformation. For example:
S3://application-transformation-app2container-automation
Customers interested in encrypting artifacts stored in the Amazon S3 bucket can enter an ARN representing the encryption key to use. The action parameters are shown in Figure 2.
Once the service launches the target instances, the post-launch action starts the modernization process.
The automation will install all needed packages to operate App2Container, execute the App2Container discovery, and the App2Container analyze processes. Once the automation is complete, operators will find an artifact in their Amazon S3 bucket. This artifact includes the analysis output of each application discovered in the migrated server.
After the process has run, select the link for the action to review the execution results of the AWS Systems Manager document as shown in Figure 3. The execution status of the post-launch action is visible in the AWS MGN console in the server details within the Migration dashboard tab.
As applications are discovered and analyzed, the automation provides operators with a progress report in the AWS Systems Manager console as shown in Figure 4:
Depending on the execution run duration, you may see some steps are executed and the rest remain as pending. This is normal and part of the mechanism to handle longer run durations. Once the automation completes its post-migration action, the following will appear in the “Outputs” section of the AWS Systems Manager document:
App2Container report generated 27-10-2023.21:08:46 from automation d41d-8cd98f-00b204e-98009-98ecf8427e
Analysis of instance i-7777777 completed successfully.
Detected the following 1 applications:
Succeeded: iis-default-web-site-a1b2c3
Please use AWS App2Container Command Line tool to continue your modernization efforts.
Refer to https://docs.aws.amazon.com/app2container/ for instructions to download and install the tool.
After installation run 'app2container init' to initialize the tool. Refer to https://docs.aws.amazon.com/app2container/latest/UserGuide/cmd-init.html for more details.
Once setup is complete you can run 'app2container containerize' for each successful application. See the list of commands below:
app2container containerize --input-archive s3://application-transformation-app2container-automation/i-0b8779481212120/iis-default-web-site-a1b2c3
To use the artifacts created by the automation, you must use the App2Container CLI to continue the modernization process. To use the App2Container commands, first initialize the App2Container CLI tool by running this command:
Once the initialization completes, you can containerize the application on the migrated server. Notice this command is found in the Outputs section of the AWS Systems Manager document above:
To test the modernized application locally, use the following Docker command to start the container:
Now that I have tested the container locally, I can continue with the deployment process. The deployment phase of App2Container is used to deploy your eligible application to Amazon ECS, Amazon Elastic Kubernetes Service, or AWS App Runner. For more information, see the AWS App2Container User Guide.
Cleanup
If you created any resources for testing functionality of the App2Container for Replatforming post-launch tile, delete these resources to avoid ongoing charges to your account.
Conclusion
In this post I explained the functionality of App2Container, how to use AWS MGN’s post-launch tile App2Container for Replatforming, and how to test your container locally. By following the steps outlined, you are now equipped to begin modernizing your applications to containers with AWS MGN in a few simple steps.
Visit the Application Migration Service User Guide to learn more about these features and understand how to use post-migration actions. You can also visit Getting started with AWS Application Migration Service to learn more about how to get started to migrate your workloads.