<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">

Migrating Cloud VMs from Amazon AWS to Windows Azure

Sandeep Dhawale Jun 25, 2014

cloud computing Technology

I have migrated to windows server 2012 EC2 instance from Amazon AWS to Windows Azure through following steps.

We assume you have Amazon account and running EC2 instances in it.

Log in to EC2 instance with credentials-

Log in to EC2 instance

Click OK-

remote desktop connection

Click Yes-

First we need to have free space on D drive on AWS Virtual machine to export the C Drive in Virtual Hard Disk (VHD) Format

We used Disk2VHD free converter tool for VHD conversion

If you do not have an additional drive then you need to add one Hard Disk and attach to running AWS EC2 instance.

Run Disk2VHD tool

Now select C drive and System reseverd Volume and give VDH file location D:\VMTEMP\WS2012VMD2.VHD

VDH File location

 

It will take time to convert.

Disc2vhd

 

After conversion is completed the copy of VHD from AWS has to be copied to your local machine-

There are number of ways to download your VHD from AWS to local machine For Example FileZilla In this case FileZilla was used to download the copy of VHD to local machine.

Download/Copy VHD to Local 2012 Hyper-V Host-

Login to 2012 Hyper-V host through RDP in Local environment

Locate to the path of VHD- D:\VMTEMP\WS2012VMD4.VHD

Open Windows PowerShell ISE on Hyper-V machine

And run following command-

$vhdTempPath ="D:\VMTEMP\WS2012VMD4.VHD"

Convert Dynamically Expanding VHD to Fixed Size VHD

$vhdConvertedPath ="D:\VHD\WS2012VMD4.VHD"

Convert-VHD -Path $vhdTempPath -DestinationPath $vhdConvertedPath -VHDType Fixed

It will take some time to convert vhd to fixed size.

Install Hyper-V Integration Services by following command-

(Command to install Hyper-V integration services on Windows server 2008 and 2008 r2 and windows 7 machine is as follows

$cabPath ="c:\Windows\vmguest\support\amd64\Windows6.X-HyperVIntegrationServices"

Command to install Hyper-V integration services on Windows server 2012 and windows 8 machine is as follows -

$cabPath ="c:\Windows\vmguest\support\amd64\Windows6.2-HyperVIntegrationServices-x64.cab"

Mount VHD path as a drive by following Command-

$diskNum = ( Mount-VHD -Path $vhdConvertedPath -Passthru).DiskNumber

Make sure VHD is online by operation status command as follows-

(Get-Disk $diskNum).operationalstatus

VHD drive letter can be known by following command-

$vhdDriveLetter = (Get-Disk $diskNum | Get-Partition | Get-Volume).DriveLetter

Make sure to make the VHD writable by following command-

Set-Disk $diskNum -IsReadOnly $False

Add-WindowsPackage -PackagePath $cabPath -Path ($vhdDriveLetter+":\")

Dismount-VHD -Path $vhdConvertedPath

To upload the VHD to Azure following are the steps-

In this case a tool called CloudXplorer was used to upload VHD to Azure Storage (Note that this can also be done through PowerShell)

Install CloudeXplorer on the local Hyper-V machine and start CloudeXplorer-

While connecting to Windows Azure Account through CloudeXplorer it will ask for Azure Account name and Secret Key (This can be found in Azure Account web portal)-

cloudexplorer

Click OK

The account will be added if the information provided is accurate.

manage accounts

 

Click OK

Then the following window pops up-

Select the account then select “vhds” on the left pane and then select “Upload page blob” as shown below.

vhds cloudexplorer

 

Select VHD file and click open as shown below.

vhds cloudexperer Upload as page

 

 

Then copy operation will start as follows and it will take time to copy vhd to Azure storage.

 

cloudexplorer uploading

Once VHD copied on Azure Storage it will display as seen below.

cloudexplorer uploaded

Login to Azure Account- Go to Storage TAB the uploaded vhd can be seen here –

storage TAB

 

Click on the storage name and then click Containers TAB

 

containers TAB

Select VHDS TAB and the copied VHD is displyed here.

copied VHD

 

Map the VHD to an Azure Virtual Machine Disk

The Next Step is to convert the VHD to Disk by following the process:

Go to Virtual Machine Tab on Azure Portal, Click Disks and click on Create TAB-

Map the VHD to an Azure Virtual Machine Disk

  • Once the upload completes login to your Azure portal. https://manage.windowsazure.com
  • Click on the Virtual Machines page and then select Disks and then Create on the bottom of the screen
  • Provide a Name and then click browse to find the VHD URL that you uploaded in the previous steps
  • You should also check the box indicating that The VHD contains an operating system. Then select the appropriate OS from the Operating System Family property. Click OK

 

virtual machines

 

create a disc from VHD

 

Click OK

The Disk is created.

Creating the Azure VM,

After completing this you can now create an Azure Virtual Machine from you .vhd you upload from your local machine.

  • Click on the Virtual Machine page again and click New in the bottom of the screen
  • Select From Gallery
  • Click on My Disks and you will find the .vhd uploaded and assigned as a Virtual Machine disk
  • Select your machine then click the arrow in the bottom right to continue

virtual machine name

 

  • Provide a name in the Virtual Machine Name property and select the resource plan you would like this virtual machine to use
  • Click the arrow in the bottom right to continue

configuration

  • Configure the DNS name for the virtual machine and which virtual group you would like to join it to then click the arrow in the bottom right to continue

configuration 2

  • Optionally you could add third-party additional extensions to the VM. Click the check to confirm your configuration of the new VM

configuration 3

  • Your VM will be provisioned and should be available immediately once these steps are complete. Keep in mind a lot of these steps that I did through the management portal could certainly be done using PowerShell as well.

virtual machines 2

 

virtual machines 3

Select the New Virtual Machine Click on Connect and login to the new machine.

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.