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-
Click OK-
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
It will take time to convert.
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)-
Click OK
The account will be added if the information provided is accurate.
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.
Select VHD file and click open as shown below.
Then copy operation will start as follows and it will take time to copy vhd to Azure storage.
Once VHD copied on Azure Storage it will display as seen below.
Login to Azure Account- Go to Storage TAB the uploaded vhd can be seen here –
Click on the storage name and then click Containers TAB
Select VHDS TAB and the copied VHD is displyed here.
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
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.
Select the New Virtual Machine Click on Connect and login to the new machine.