Migrate On-Premise Application Server to AWS Cloud

Intro:

As a part of AWS cloud migration, today we will see how to migrate a on-premise application server to AWS cloud using VM Import/Export Method

Scenario:

  1. Have installed VMware workstation on my local laptop.
  2. Created a VM having OS 2012 R2
  3. It has 2 disks attached, one for OS & other one is for Application (refer below snapshot)
  4. Installed and configured a PHP application ( I kept installation & configuration files in H: )
  5. Here the application & DB hosted on a same server

Before the migration, the disk management window looks like as below

The network window is looks like as below

And the application (carjack) that is running & live is as shown below

Export & Copy the vmdk Files to S3:

Now shutdown the VM, export the VM to a folder & copy both the vmdk files to S3 bucket. ( Here we have attached 2 disks hence two vmdk files will be created )

My 2 vmdk files are as shown below

Note: How to create a S3 bucket & copy the vmdk files can be done by refering the link

Also change the bucket name as per your environment 🙂

Import the Disks:

Here we have 2 disks, one is OS disk another is Application (Data) disk. So let’s do it one by one.

Step- 1 : Importing the OS Disk

In my case disk-1 is the OS disk, hence I will use the following command to import as an OS image & create an AMI to Launch the instance.

aws ec2 import-image --disk-containers Format=vmdk,UserBucket="{S3Bucket=jrp-mig-store,S3Key=Windows-Web-App-disk1.vmdk}"

You will get the following screen in next step

Status can be chcked using following command

aws ec2 describe-import-image-tasks --import-task-ids import-ami-05e2548a26af01733

Once import completed the message will be as follows.

And you will see the AMI is created in EC2 console

Step-2: Import the Aplication Disk

Here we will import the application disk as an snapshot

aws ec2 import-snapshot --description "App-Server-data-vol" --disk-container "file://D:\import\containers.json"

Note that this time I have used a JSON file for import, the json code is as below

{
    "Description": "App-Server-data-vol",
    "Format": "vmdk",
    "UserBucket": {
        "S3Bucket": "jrp-mig-store",
        "S3Key": "Windows-Web-App-disk2.vmdk"
    }
}

Once the import completed, you will see the following message and a snapshot will be available in the EC2 console.

Launch EC2 Instance & Attach Disk:

Now launch an instance using the above AMI, you will see something like below post the EC2 instance is launched.

Now launch a volume using the Aplication disk snapshot

Now attach the volume to the instance you have created in earlier step

Now start the instance, attach appropriate security group and take RDP 🙂

Note: You will have to bring the Application disk online from disk management console

I can see both disks are online as it was

But when I tried to access the application i got below 🙁 This is not what we are expecting……

TO fix this, ensure you have allowed the required protocols/port in Srcurity group (Also check NACL if you have configured any rule)

I have allowed the http:80 and it started working!!! 🙂

Now copy/use the EC2 instance public IP & try to access the application, it should work.

Thats it for today folks!! see you in next blog

I will use cloudendure in my next AWS migration blog to migrate VM & workloads.