AWS Application Migration Service-Hands-On Guide

939 views 25 slides Aug 31, 2022
Slide 1
Slide 1 of 25
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25

About This Presentation

AWS Application Migration Service (MGN)-Hands-On Guide


Slide Content

AWS Application Migration Service (AWS MGN):
Situation: Migrate the Source Servers AS-IS, means lift and shift to another AWS region
Task: Replicate the Source Servers into another AWS region, test your website on the new target server. If the testing
is successful then perform a server cut over
Action: Use AWS Application Migration Service (AWS MGN) which is a highly automated lift-and-shift (re-host)
solution to perform the server migration
Results: AWS Application Migration Service (MGN) simplifies, expedites, and reduces the cost of migrating
applications to AWS. It enables companies to lift-and-shift a large number of physical, virtual, or cloud servers without
compatibility issues, performance disruption, or long cutover windows. When you’re ready, it automatically converts
and launches your servers on AWS so you can quickly benefit from the cost savings, productivity, resilience, and
agility of the Cloud. Once your applications are running on AWS, you can leverage AWS services and capabilities to
quickly and easily re-platform or refactor those applications – which makes lift-and-shift a fast route to
modernization.
AWS Application Migration Service Architecture (AWS MGN):

Steps to migrate/ replicate Source Servers to another AWS region using AWS MGN:
 Launch an EC2 instance with public IP enabled and inbound ports 22 (SSH) and 80 (HTTP) open in any AWS
region of your choice to be copied over. This will be your source region and server (US-WEST-1)
 SSH into your Linux EC2 instance and switch to root (sudo) and install enable and start httpd as 1. Install
httpd => sudo yum install httpd 2. Enable httpd => sudo systemctl enable httpd 3. Start httpd => sudo
systemctl start httpd 4. Check the status => sudo systemctl enable httpd

[ec2-user@ip-10-0-1-219 ~]$ sudo yum install httpd
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.54-1.amzn2 will be installed
--> Processing Dependency: httpd-tools = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: system-logos-httpd for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: mod_http2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem for package: httpd-2.4.54-1.amzn2.x86_64

--> Processing Dependency: /etc/mime.types for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Running trans

[ec2-user@ip-10-0-1-219 ~]$ sudo systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to
/usr/lib/systemd/system/httpd.service.
[ec2-user@ip-10-0-1-219 ~]$ sudo systemctl start httpd

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.54-1.amzn2 will be installed
--> Processing Dependency: httpd-tools = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: system-logos-httpd for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: mod_http2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Running trans

[ec2-user@ip-10-0-1-219 ~]$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2022-07-21 00:39:48 UTC; 22s ago
Docs: man:httpd.service(8)
Main PID: 3884 (httpd)
Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec"
CGroup: /system.slice/httpd.service
├─3884 /usr/sbin/httpd -DFOREGROUND
├─3885 /usr/sbin/httpd -DFOREGROUND
├─3886 /usr/sbin/httpd -DFOREGROUND
├─3887 /usr/sbin/httpd -DFOREGROUND
├─3888 /usr/sbin/httpd -DFOREGROUND
└─3889 /usr/sbin/httpd -DFOREGROUND

 Create a test html file on the EC2 instance as index.html
<HTML>

<HEAD>

<TITLE>Your Title Here</TITLE>

</HEAD>

<BODY BGCOLOR="FFFFFF">

<CENTER><IMG SRC="clouds.jpg" ALIGN="BOTTOM"> </CENTER>

<HR>

<a href="http://somegreatsite.com">Link Name</a>

is a link to another nifty site

<H1>This is a Header</H1>

<H2>This is a Medium Header</H2>

Send me mail at <a href="mailto:[email protected]">

[email protected]</a>.

<P> This is a new paragraph!

<P> <B>This is a new paragraph!</B>

<BR> <B><I>This is a new sentence without a paragraph break, in bold italics.</I></B>

<HR>

</BODY>

</HTML>

 Place your index.html file in /var/www/html/ and some the html text.
[ec2-user@ip-10-0-1-219 html]$ pwd
/var/www/html
[ec2-user@ip-10-0-1-219 html]$ ls -ltr
total 4
-rwxrwxrwx 1 root root 587 Jul 21 00:59 index.html
[ec2-user@ip-10-0-1-219 html]$
 Browse html file using instances’ public IP
 Initialize the AWS MGN
 In order to use the AWS MGN service, the service must first be initialized for any AWS region in which you
plan to use AWS MGN and copy the server over, which is your target region (us-west-2)
 Go to AWS MGN => Getting Started => Set up an Application Migration Service

 Leave all the options AS-IS and click on “Create Template” (this will allow MGN to create the IAM roles and
the security groups required to facilitate data replication, and the launching of your migrated servers)

 Generate the required AWS credentials
 Go to IAM => User => Add User
 Provide a user name (based on your choice)
 Select the Access Type as Programmatic
 Choose the attach existing policies directly and attach – AWSApplicationMigrationAgentPolicy
 After the user is created store/ copy the username, access key id, and the secret access key
 Install the replication agent on the Source Servers
 SSH into your Source Servers, and download the agent installer on your Source Servers using the command -
sudo wget -O ./aws-replication-installer-init.py https://aws-application-migration-service-us-west-
2.s3.amazonaws.com/latest/linux/aws-replication-installer-init.py (here us-west-2 is the target server)

[ec2-user@ip-10-0-5-33 html]$ sudo wget -O ./aws-replication-installer-init.py https://aws-application-migration-
service-us-west-2.s3.amazonaws.com/latest/linux/aws-replication-installer-init.py
--2022-04-02 01:22:50-- https://aws-application-migration-service-us-west-2.s3.amazonaws.com/latest/linux/aws-
replication-installer-init.py
Resolving aws-application-migration-service-us-west-2.s3.amazonaws.com (aws-application-migration-service-us-
west-2.s3.amazonaws.com)... 52.218.178.91
Connecting to aws-application-migration-service-us-west-2.s3.amazonaws.com (aws-application-migration-service-
us-west-2.s3.amazonaws.com)|52.218.178.91|:443... connected.

HTTP request sent, awaiting response... 200 OK
Length: 13740 (13K) [binary/octet-stream]
Saving to: ‘./aws-replication-installer-init.py’
100%[======================================>] 13,740 --.-K/s in 0s
2022-04-02 01:22:50 (112 MB/s) - ‘./aws-replication-installer-init.py’ saved [13740/13740]
 Install the agent after the agent installer has successfully downloaded using the command

 [ec2-user@ip-10-0-5-33 html]$ sudo wget -O ./aws-replication-installer-init.py https://aws-application-
migration-service-us-west-2.s3.us-west-2.amazonaws.com/latest/linux/aws-replication-installer-init.py
--2022-04-25 22:04:50-- https://aws-application-migration-service-us-west-2.s3.us-west-
2.amazonaws.com/latest/linux/aws-replication-installer-init.py
Resolving aws-application-migration-service-us-west-2.s3.us-west-2.amazonaws.com (aws-application-migration-
service-us-west-2.s3.us-west-2.amazonaws.com)... 52.92.160.234
Connecting to aws-application-migration-service-us-west-2.s3.us-west-2.amazonaws.com (aws-application-
migration-service-us-west-2.s3.us-west-2.amazonaws.com)|52.92.160.234|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13740 (13K) [binary/octet-stream]
Saving to: ‘./aws-replication-installer-init.py’

100%[========================================================================================>]
13,740 --.-K/s in 0s

2022-04-25 22:04:50 (164 MB/s) - ‘./aws-replication-installer-init.py’ saved [13740/13740]

[ec2-user@ip-10-0-5-33 html]$ sudo python3 aws-replication-installer-init.py --region us-west-2 --aws-access-key-id
AKIASVEZZXLB6Y7AZMGJ --aws-secret-access-key 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 --no-prompt
The installation of the AWS Replication Agent has started.
Identifying volumes for replication.
Identified volume for replication: /dev/xvda of size 8 GiB
All volumes for replication were successfully identified.
Downloading the AWS Replication Agent onto the source server... Finished.
Installing the AWS Replication Agent onto the source server... Finished.
Syncing the source server with the Application Migration Service Console... Finished.
The following is the source server ID: s-51e9ba7173f604b3d.
You now have 1 active source server out of a total quota of 20.
Learn more about increasing source servers limit at https://docs.aws.amazon.com/mgn/latest/ug/MGN-service-
limits.html

The AWS Replication Agent was successfully installed.
[ec2-user@ip-10-0-5-33 html]$

[ec2-user@ip-10-0-5-33 html]$ sudo python3 aws-replication-installer-init.py
The installation of the AWS Replication Agent has started.
AWS Region Name: us-west-2
AWS Access Key ID: AKIASVEZZXLB7GHMS6YV
AWS Secret Access Key:
Identifying volumes for replication.
Choose the disks you want to replicate. Your disks are: /dev/sda,/dev/xvda
To replicate some of the disks, type the path of the disks, separated with a comma (for example, /dev/sda,/dev/sdb).
To replicate all disks, press Enter:
Identified volume for replication: /dev/xvda of size 8 GiB
All volumes for replication were successfully identified.
Downloading the AWS Replication Agent onto the source server... Finished.
Installing the AWS Replication Agent onto the source server... Finished.
Syncing the source server with the Application Migration Service Console... Finished.
The following is the source server ID: s-51e9ba7173f604b3d.
You now have 1 active source server out of a total quota of 20.
Learn more about increasing source servers limit at https://docs.aws.amazon.com/mgn/latest/ug/MGN-service-
limits.html
The AWS Replication Agent was successfully installed.

 Provide the target region (for an example, us-west-2) where AWS MGN is initialized and where the server has
to be replicated
 Provide the user’s Access Key ID and Secret Access Key
 Choose to replicated all disks (‘Enter’ to replicated all disks)
 Agent should be downloaded, installed, and the server should be synced with AWS MGN of the selected
region, and visible via the AWS MGN console
 Provision AWS MGN Replication Server
 Click on the Source Servers and monitor the life cycle progress, replication initiation steps
 Go to EC2 and look for AWS MGN service replication server. As per your template a server will be
provisioned
 Edit launch settings and template (If you would like to change the launch settings and the template – it’s an
optional steps) Note: While creating the template create new SG using inbound port 80 & 22, and also make
sure the instance has the public IP

 Click on the Source Servers => Launch settings => EC2 Launch template
 Enter the launch template name
 Go to EC2 => Launce template => Go to the corresponding launch template
 In case if you would like to make changes, then
 Go to Actions => Modify Template => Make required changes and click on => Create Template Version
 Once the version is created, select the version from the dropdown and go to Actions => Set Default Version


Repeat the same AWS replication agent installation process on all source servers.
After installing the AWS replication agent on the source servers, return to the AWS MGN console to validate the
source servers in the console. Please note that the source servers are added to the AWS MGN console by installing
the AWS replication agent on the source servers.

After the initial sync is complete, the migration lifecycle displays Ready for testing and the data replication status
displays as Healthy.

Configure the launch settings
Prior to testing or cutting over an instance, configure the launch settings. The launch settings are a set of instructions
that determine how a test or cutover instance is launched for each source server in AWS.
Launch settings are comprised of two sections: general launch settings and Amazon EC2 launch templates.
Select each server, and select the tab for Launch Settings to edit the launch settings.
For this walkthrough, we will keep the default settings for the general launch settings. And, we will be making
changes to the Amazon EC2 launch template, to place the App Server and DB Server in the right subnets, which you
have created with the necessary security groups.
Amazon EC2 launch template modification for the App Server (source server):
Starting with the App Server, select modify in the Amazon EC2 Launch template window.
This would launch a new window for the Amazon EC2 Launch templates. Add a description for the Template version
description.
 Wait for initial sync to complete (it may take 15-20 minutes)
 Edit the launch template first
 Edit the Source Server launch template (with Instance type right sizing is off)

 Edit the target EC2 instances’ launch template

Navigate down to Network Interfaces. Under Subnet, choose the respective subnet, Migrated Resources Public
Subnet for the app server, Security groups, and select Enable under Auto-assign public IP for the public facing app
server. Once done, select Create template version.

This launches a new window that shows you have successfully modified the EC2 Launch Template. Now, you would
go ahead to change the default version that the EC2 launch template would use, select View Launch Template.

Launch the test instances

Now, that you configured the launch settings for each source server, you are ready to launch the servers as test
instances. Best practice is to test instances before cutover.
On the MGN console page, make sure that your source servers are ready for testing by looking at the following
indicators as shown in Figure 14. The source servers are Healthy and Ready for testing.

Select Test and Cutover in the top right corner, then select Launch test instances.
 Launch the Test Instance
 Select the Source Servers => Test and Cutover => Launch Test Instance
 A test instance should be launched as per your Launch Template
 Click on the Source Servers => Lifecycle => Click on the job id and monitor the progress
 Go to EC2 => A new AWS MGN service conversion server should be launched
 Once the conversion is complete a test instance should be available
 Test the application by browsing index.html using the test instances’ public IP
After the testing is complete => Select the Source Servers => Test and Cutover => Mark Ready for Cutover

This takes you back to the MGN console page with the source servers. Make sure that the Migration
lifecycle indicates that Test in progress, then select View job details in the top right corner to view the MGN job log
details.

With a successfully launched application in the web browser, you can select Mark as “Ready for Cutover”. Cutover.

 Launch the Cutover Instance & Archive
 Select the Source Servers => Test and Cutover => Launch Cutover Instance
 A cutover instance should be launched as per your launch template
 Click on the Source Servers => Lifecycle => Click on the job id and monitor the progress
 Go to EC2 => A new AWS MGN service conversion server should be launched
 Once the conversion is complete a cutover instance should be available
 Test the application by browsing index.html using the cutover instances’ public IP
 After the testing is complete => Select the Source Servers => Test and Cutover => Finalize Cutover
Once the cutover is complete => go to the Source Serverss => Action => Mark archived ( to archive the Source
Servers. Archiving servers prevents them being shown in the servers list page.)

AWS Links:
https://docs.aws.amazon.com/mgn/latest/ug/linux-agent.html
https://docs.aws.amazon.com/mgn/latest/ug/what-is-application-migration-service.html