APPLICATION MIGRATION IN AWS
Tags: aws, devops, cloudskills
Published: 2022-04-03 11:37:51

Application migration is the process of moving software applications from one computing environment to another. This can include migrating applications from one data center to another, such as from a public to a private cloud, or from a company's on-premises server to a cloud provider's environment.

Here we will see how we can migrate our server form one AWS account in one region to another AWS account in some other region or in same region.

This is the server(source server) of Singapore region which we are going to migrate to Mumbai region of another AWS account.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vqkewczlbgwwz6wt1sto.png)


This is the sample web site(downloaded from  free-css.com) which is hosted form the source server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbfd4c1y34zmxth65s91.png)


Now in your destination AWS account and go to "AWS Application Migration Service" and click on "Get started". 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gubvjdon9ahzywqcwxbp.png)

Then click on "Add servers"

First we need to select our application server type(i.e. Linux)
Then click on create IAM user

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igcmnqef0tfvyyg4z2ge.png)

Once you created an IAM user by the name "mgn-agent-installer" then copy and past the **Access key ID** and **Secret access key**
in their respective place.

Now copy the " Download the installer using this command:" by clicking on the copy button and past it in the Xshell (paste in the  source server).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxt60oinw606lzpswip2.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mxluol3yj1quebwrfc49.png)


Repeat the same process for step 5( Copy and input the command below into the command line on your source server)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qo4fqk2i10btxs1ghf8f.png)

Then go back to the "Source servers" and click on your "Source server name"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b3ajxgwcu1bz53ahez6i.png)

Then go to "Launch settings and click on "modify"(EC2 Launch Template)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qaaf7wo03mielhl45t3.png)

Now keep things same as shown in the pictures below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dy2w6ybepcqiuutggtm3.png)

The instance type must be same as of your source server, then you need to give a key pair for your destination instance and you also need to specify the subnet inside which you want to deploy the server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4gf6e6cvvtf0whi7qqae.png)

Now assign a security group(allow http, https, ssh)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2wk71zgan1vrwtr7sdy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3hwnc0va1yaxwixq1jcl.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtgsu6y1iz3ut8w3id05.png)

Then click on "Create template version"

Go to "Launch templates" select the template click on "Action" and click on "Set default version".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aonghw3l3txwobkk8v3b.png)

Now again go to your source server and then click on launch setting and then click on edit (General launch settings) and make "Instance type right sizing" **OFF**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1zxnjg3nykpkzlva3ldu.png)

Now wait until the "lifecycle" becomes "ready for testing"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gho7112ffy3bgur7g4jp.png)

After it becomes ready for testing. Go to source servers and "launch test instances"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yn0g1dm9wkmvjnytwerg.png)

If you go to ec2 instances you can see that automatically some instances are created and terminated for testing purpose

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t5yu34bvp4dp5ka6xd9n.png)
wait until the instance(1.compute.internal) is created and status is checked(2/2 check pass)
Associate an elastic IP to it so that we can test weather the web page is successfully transferred to the server or not

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2qmah0wmx85mauxbrfl.png)

Now if you past the elastic IP in the browser you can see webpage is up and running.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hqoa5ls3yfofzfoxi3m9.png)

So, our testing process is completed.
The next step is to go to the source servers and make the server "ready for cutover"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9wie8d3pst6msqyj7ep.png)

Then launch cutover instance

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gr987cm0zf24ubwgd5cu.png)

Once this instance becomes ready associate the elastic IP to it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7awx399os5wpvm6g4re.png)
The above server is the final migrated server.

Now go to Application migration and finalize cutover

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfytnbve3zml7lmfs9r6.png)

Then mark as archived

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yytqvy5u36h8scn61knx.png)
This was the complete process of application migration.
Now you can delete and terminate all the other things except (compute.internal) this server and the allocated elastic IP to it.