Select Page

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).

Install Java

Download and install Java if you do not already have it:

Download APIs

  1. EC2 Command line tools:
  2. Elastic Load Balancing tools:

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

  1. Go to
  2. Log in
  3. Scroll down to the X.509 section
  4. Create a new certificate (if one does not exist)
  5. Download the Private Key File (pk-.pem) and store in AWS directory
  6. Download the Certificate File (cert-.pem) and store in AWS directory
  7. 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:
[sourcecode language=”plain”]
SET JAVA_HOME=”C:\Program Files (x86)\java\jre6″
SET EC2_PRIVATE_KEY=c:\aws\aws-pk.pem
SET EC2_CERT=c:\aws\aws-cer.pem
SET EC2_HOME=c:\aws\ec2\ec2-api-tools-
SET AWS_ELB_HOME=D:\aws\ElasticLoadBalancing-
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.

Test Command

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
REGION us-east-1

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.

  1. 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.
  2. 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.
  3. Uninstall VMware tools- if you have installed the VMWare tools, remove them.
  4. 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.

    1. Download the too from:
    2. Open a command line with administrator privileges
    3. 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.

  1. Open awsTools.bat
  2. Get Access Key and Secret Access Key from AWS: My Account / Console > Security Credentials
  3. Create Import instance using ec2-import-instance
    1. 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
    2. b. -o = Access Key
    3. c. -w = Secret Access Key
    4. d. -t = Instance Types (see
  4. Wait until the Instance is uploaded and converted
    1. Use ec2-describe-conversion-tasks to check status
  5.  Start Instance
  6. Open up RDP port (3389) using the AWS Security Group inbound rules
  7. Obtain an Elastic IP from AWS
  8. Under Network Interfaces in AWS, assign Elastic IP to the network interface that belongs to the instance
  9. 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

matiasimc. (June 21, 2011). Re: VMWare Workstation VM import Windows 2008 R2 failing. Retrieved March 29, 2012, from

VMware. (May 21, 20009). VMware OVF Tool. Retrieved March 29, 2012, from


%d bloggers like this: