This document describes the steps necessary to migrate a VMWare virtual machine (.vmx and accompanying .vmdk) to the Amazon Web Services (AWS) cloud.
Setting up AWS Command Line Tools
There are many actions in AWS that can only be completed by using the AWS command line tools. This section describes the steps necessary to set up these tools (Evens, 2009).
Download and install Java if you do not already have it: http://www.java.com/en/download/manual.jsp#win.
- EC2 Command line tools: http://aws.amazon.com/developertools/351
- Elastic Load Balancing tools: http://aws.amazon.com/developertools/2536?_encoding=UTF8&jiveRedirect=1
It is a good idea to pick somewhere to place all of your command line related items; for example: C:\AWS. Unzip both archives into this folder.
Get your AWS Certificates
- Go to https://aws-portal.amazon.com/gp/aws/securityCredentials
- Log in
- Scroll down to the X.509 section
- Create a new certificate (if one does not exist)
- Download the Private Key File (pk-.pem) and store in AWS directory
- Download the Certificate File (cert-.pem) and store in AWS directory
- KEEP THESE FILES PROTECTED – they provide access to your AWS account
Configure Environment Variables
Create a batch file in your AWS directory awsTools.bat and add the following text:
SET JAVA_HOME=”C:\Program Files (x86)\java\jre6″
JAVA_HOME will need to be set to the appropriate path for your machine. Find java.exe (it will be a in a folder called bin) and set JAVA_HOME to the parent directory of bin. For example with java.exe at “C:\Program Files (x86)\java\jre6\bin\java.exe” set JAVA_HOME to “C:\Program Files (x86)\java\jre6”.
EC2_HOME and AWS_ELB_HOME both point to the folders you unzipped the APIs into.
If you run awsTools.bat you should have a command prompt that you can run the EC2 tools from.
Type ec2-describe-regions at the command prompt
Your results should look something like the following:
REGION eu-west-1 eu-west-1.ec2.amazonaws.com
REGION us-east-1 us-east-1.ec2.amazonaws.com
If you get an error or nothing is returned, check your configuration.
Setting Up Your VMware Image
There are several changes that should be made (if needed) to your VMware image before it is converted and uploaded to AWS.
- Remove all snapshots – remove any snapshots that you may have. If you do not want to remove snapshots, create a copy of your .vmdk and create a new VMware image that points to it.
- Partition must be IDE – If you have any SCSI Devices, you should convert them to IDE. You may want to use a third party tool to do this such as Acronis.
- Uninstall VMware tools- if you have installed the VMWare tools, remove them.
- Enable Remote Desktop Access – you will want to enable remote desktop connections and make sure that they are permitted through the firewall (if enabled).
Convert VM to OVF
OVF (Open Virtual Format) is a universal virtual machine format that is used for distribution across organizations and products. You must convert your VMware image to this format so that AWS can convert it to its virtualization format. This process may take several hours depending on the size of the image.
- Download the too from: http://www.vmware.com/resources/techresources/1013
- Open a command line with administrator privileges
- Example Syntax:
ovftool “C:\Virtual Machines\Windows Server 2008 x64.vmx” “C:\Virtual Machines\Windows Server 2008 x64.ovf”
Import to AWS, Setup & Connect
Once the VM has been converted to OVF format, it is ready to be imported to AWS.
- Open awsTools.bat
- Get Access Key and Secret Access Key from AWS: My Account / Console > Security Credentials
- Create Import instance using ec2-import-instance
- Example Syntax:
ec2—import—instance “C:\Documents\Virtual Machines\Windows Server 2008 x64—disk1.vmdk” -f vmdk -t ml.large —a x86_64 —o XXXXXXXXXXXXXXXXXXXX —w XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX —b my_bucket
- b. -o = Access Key
- c. -w = Secret Access Key
- d. -t = Instance Types (see http://aws.amazon.com/ec2/instance-types/)
- Wait until the Instance is uploaded and converted
- Use ec2-describe-conversion-tasks to check status
- Start Instance
- Open up RDP port (3389) using the AWS Security Group inbound rules
- Obtain an Elastic IP from AWS
- Under Network Interfaces in AWS, assign Elastic IP to the network interface that belongs to the instance
- Connect via RDP using Elastic IP address
Evens, S. (May 19, 2009). Setting up EC2 command line tools on Windows. Retrieved March 20, 2012 from http://sevans.info/2009/05/19/setting-up-ec2-command-line-tools-on-windows/.
matiasimc. (June 21, 2011). Re: VMWare Workstation VM import Windows 2008 R2 failing. Retrieved March 29, 2012, from https://forums.aws.amazon.com/thread.jspa?threadID=58171.
VMware. (May 21, 20009). VMware OVF Tool. Retrieved March 29, 2012, from http://www.vmware.com/resources/techresources/1013.