Article

Setting Up an AWS Application Migration Service Template

Gerardo Guzmán Sánchez, Cloud Engineer at IO Connect Services

April 25, 2022

How to configure the AWS Application Migration Service (AWS MGN) to replicate the source server in an AWS region

 

3

 

Pre-requisite

 

  • You will need to get an AWS account
  • Basic knowledge of AWS services

 

Steps to set up the AWS Application Migration Service

 

Before starting, consider the following points:

 

  • We will use the default VPC, so we don't need to set one up.
  • The EC2 instance with public IP for this article is created following the best practices.
  • Don't forget to delete all the resources created when the test has been successful.

 

  1. Provision of a source server to be copied

 

Go to the AWS console in the region you prefer, select the service EC2 (Virtual Servers in the Cloud), and launch the instance. Select the Amazon Machine Image and Instance Type you choose for your project with Public IP and create a security group with port 22 and port 80 enabled on inbound rules. See the images below.

 

  1. Choose an Instance Type

 

5
  1. Configure Public IP

 

6
  1. Configure Security Groups

 

7
  1. Using puTTY

 

Once the server is deployed, it is time to connect across SSH into your EC2 instance and switch to root and install, enable, and start httpd in PuTTY.

By using the Public IP assigned to your EC2 instance, you can connect to the server and use third-party software like puTTY to open the connection. See the images below.

 

8
  1. Installing Apache

 

9
  1. Starting the HTTPD service

 

10
  1. Create HTML File

 

Create a test HTML file on the EC2 instance and save it as index.html.

Place your index.html in /var/www/html/ and add some sample html text. This html file will act as your website.

Go to the web browser and test your html file using the EC2 instance public IP.

 

11
  1. Initialize AWS Application Migration Service (MGN)

 

Select on AWS Console the service Application Migration Service (automates lift-and-shift migration). The service must be initialized in any AWS region you plan to use and copy the source server over your target region. Verify the subnet ID and VPC of the EC2 instance source server, select the security group, and create a template.

 

12
  1. Defining Subnet

 

This is the subnet where AWS Application Migration Service will create Replication Servers.

 

13
  1. Defining Tags

 

14

 

  1. Replication Settings

 

15

The template has been created successfully.

 

  1. Generate AWS Credentials

 

In the AWS Console, go to the global service IAM (Manage access to AWS resources). In Access Management go to Users and adds a user.

Provide and Username and select Access type as Programmatic.

Choose the Attach existing policies directly and attach AWSApplicationMigrationAgentPolicy.

When the user has been created, copy the Username, Access Key ID, and Secret Access Key in a notepad.

1617

 

  1. Install Replication Agent on Source Server

 

  1. Download Agent

 

In puTTY, in the same SSH connection from the EC2 instance source server, download the agent installer using the below command.

wget -O ./aws-replication-installer-init.py https://aws-application-migration-service-replicationregion.s3.amazonaws.com/latest/linux/aws-replication-installer-init.py

18
  1. Install Agent

 

Install the agent after the agent installer has successfully downloaded.

 

sudo python3 aws-replication-installer-init.py

 

For this process, you need to set the replication region where the EC2 instance is replicated and use the Access Key ID and Secret Access Key generated by the IAM user.

 

19
  1. Agent up , running & replicating

 

The Replication has started. Once the agent is installed, you will see information about it in the Application Migration Service Source Servers list. See the image below.

 

20

 

21

 

 

  1. Sync & Monitoring

 

At this point, the source server should be synced with AWS MGN of the selected region and be visible.

 

22

You can monitor the progress of replication.

23

 

  1. Replication Settings

 

You can configure custom replication settings for a specific system on this tab. It may be helpful, especially for servers that experience many changes on their disks. You may want to change the Replication Server instance type to one with more bandwidth and assign a dedicated Replication Server.

 

24

 

  1. Launch Settings

 

On this tab, you can configure details of how the EC2 instance of the replicated system should be configured in AWS. We will disable automated correct sizing and define the expected configuration of the target EC2 machine.

 

25

 

26

 

Click on the Modify button in the EC2 Launch Template section and confirm you want to Modify the launch template.

 

27

 

Review the various options available on the Modify template (Create new version) page by clicking on the Info link next to each section title.

Scroll to the Instance type section and change the selection to t3.small machine instance type when you're done.

28

 

  1. Networking Settings

 

Finally, in the Network interfaces section, for the first Network interface, set Auto-assign public IP to Enable to make sure the webserver will be accessible over public IP and select TargetVPC-public-a as the subnet - this is where we want our webserver to run after the migration.

29

In the Launch Templates from the EC2 section, go to the Versions tab and select the latest version by clicking on the radio box on the left.

From the Actions menu, select Set default version.

30

 

  1. Provision AWS MGN Replication Server

 

Go back to the Application Migration Service, go to server details, click on the Test and Cutover button, and select Launch test instance from the menu.

31

Click on the source server and observe the life cycle progress and the Replication initiation steps.

Go to EC2 and look for AWS Application Migration Service Replication Server.

As per your template, a server will be provisioned.

This is a time-consuming step; hence be patient. Once the server is provisioned, initial data synced, and a snapshot is created, it will be ready for testing.

 

32

 

33

 

Go back to Source Servers, click on your server Hostname, then Test and Cutover -> Mark as "ready for cutover" and Continue on the popup to confirm that the testing went successful and testing instance can be terminated.

34

 

35

 

36

 

Go back to Source Servers, click on your server Hostname, then Test and Cutover -> Mark as "ready for cutover" and Continue on the popup to confirm that the testing went successful and testing instance can be terminated.

 

3738

 

39

 

40

 

 

Now you are ready to launch the cutover instance.

 

41

 

This will trigger the cutover job (it will take ~10-15 minutes). After clicking on Cutover Job ID in the Lifecycle section, you can find its details.

 

42

Cutover completed.

Wait for the Launch status to change from Waiting to Launched / First boot: Started. Your webserver will be visible and Running in the EC2 Console at this stage.

 

43

Finalize the cutover.

Click on Test and Cutover -> Finalize cutover, then confirm finalization of cutover to stop replication and cleanup resources used by Application Migration Service. Your migrated webserver, of course, will still be there in the EC2 Console!

 

4445

 

46

 

Go back to the EC2 section, select the Replication copy of the public IP, and verify the replication source server in the browser.

 

47

 

48

 

AWS Application Migration Service (AWS MGN) Benefits

 

This article shows how to migrate applications to the cloud without changes and minimize time-intensive, error-prone manual processes by automatically converting your source servers from physical, virtual, or cloud infrastructure to run natively on AWS. It further simplifies your migration by enabling you to use the same automated process for various applications.

 

Some of the benefits of Application Migration Service are:

  • Cutover windows of minutes and no data loss
  • Large-scale migrations with no performance impact
  • Comprehensive platform and source Operating Systems support
  • Automated migration to minimize IT resources and project length

How can we help you?

IO Connect Services is here to help you by offering cost-effective, high quality technology solutions.