Running Windows on the Amazon Elastic Compute Cloud with Qemu and Linux

Level: Introductory
November 05, 2006
Khazret Sapenov, Reuven Cohen (Enomaly) >

1 Abstract

This tutorial explains how to set up and run Windows on the Amazon Elastic Compute Cloud Beta with the help of Qemu and Linux. This HOWTO can be adapted to install any guest operating system supported by QEMU. We have chosen Windows Server 2003 because they offer a free evaluation copy, but QEMU can be used for emulating other operating systems - including, Solaris, *BSD, Unix, etc.


2 Prerequisites and required components

  • You need to have an account with Amazon Elastic Compute Cloud (
  • Basic Linux/Unix administration skills
  • Linux/Unix distribution (Fedora Core 6, Ubuntu, Debian, *BSD) as a base for your experiments (You can also do it in Windows, using Vmware appliances).
  • Processor emulator QEMU ( for x86 (currently Amazon doesn't support 64-bit version of QEMU).
  • Windows Installation in ISO format
  • Batteries not included, Some assembly required. :)

This HOWTO can be adapted to install any guest operating system supported by QEMU. We have chosen Windows Server 2003 because they offer a free evaluation copy, but QEMU can be used for emulating other operating systems - including, Solaris, *BSD, Unix, etc.

"Installation/QemuEmulator".? In many ways, Windows is not the best choice, as it is slower than either Windows 9x or Windows 2000 under emulation. But for many of us, it will be what we have lying around. There is nothing in this HOWTO that is Windows specific. There may well be specific issues for non-Windows versions operating systems.

If your using Windows desktop, you may want to view the Qemu in Windows tutorial.


3 Licensing

Your Windows license only allows one install of Windows at a time. Installing Windows on a virtual machine while simultaneously having the same copy on another partition or machine will break that license.

* Windows Server 2003 R2 Trial Software Download (


4 Setting Up Local Environment


4.1 Fedora Core 6

We have chosen Fedora Core 6, but this tutorial should help you in Fedora Core 5 and 4 as well.


4.1.1 installing qemu

The easiest way to install qemu was:

yum install qemu

Though you can compile it from source as well, it'll definitely give more options. Read instructions how to do it at qemu site.


4.1.2 creating windows image

To install Windows you will need to create a virtual drive to store it on:

qemu-img create -f qcow winxp.img 4G

This creates a 4 gigabyte virtual drive called winxp.img in the location where you ran the command. Now let's install Windows:

qemu -hda winxp.img -cdrom yourDistro.iso -m 256 -boot d

This tells QEMU to use the virtual disk as the harddisk (-hda winxp.img), which drive to use as the CDROM (in this case it's your image file) and to allocate 256Mb of memory for the virtual pc (-m 256). Once QEMU boots up, you will be in the Windows install. This is identical to any other installation of Windows. Follow the standard Windows installation and after a few reboots of QEMU and about 40 minutes, you will have a copy of Windows installed on your virtual drive.

You will likely need to interact with the install. Just click on the QEMU window and interact away.When you need your mouse, press CTRL+ALT and your mouse is free. You can also toggle fullscreen with ALT+CTRL+F. For full list of options just run qemu without any options in terminal.

When you have finished playing with the installation, you will eventually want to shut it down - which you do via the start menu as for any other Windows installation. To "turn off your computer", just close the QEMU window. To test your newly installed Windows, run qemu again:

qemu -hda winxp.img -m 256 -boot c

This should load usual Windows startup screen.


Important ! At this step you need to enable remote access to this machine, to be able to administer it once it's at Amazon.


4.1.3 Bundling and Uploading our AMI to Amazon EC2

The Amazon EC2 AMI Tools are command-line utilities to help bundle an Amazon Machine Image (AMI), create an AMI from an existing machine or installed volume, and upload a bundled AMI to Amazon S3. Now we are ready to bundle our system and upload the snapshot to Amazon Elastic Cloud. To do this, we will need auxiliary tools (i assume you have sufficient privileges to install programs in your system):

yum install ruby
rpm -Uvh ec2-ami-tools.noarch.rpm

At this point, the machine image should be ready for bundling:

ec2-bundle-vol -d /mnt -k ~root/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -u 495219933132 -s 1536

Note: all keys should contain your personal private key and X.509 certificate.

This command may take several minutes to complete. Once the bundling process has been completed, the AMI, its associated manifest file and image parts can be found in the /mnt directory. Confirm this with the following command:

ls -l /mnt/image.*

Uploading the AMI to Amazon S3.

All AMIs are loaded from Amazon S3 storage. The newly bundled AMI needs to be uploaded to an existing account on Amazon S3 such as the one you created in the section called “Signing up for Amazon S3”.

S3 stores data objects in buckets, which are similar in concept to directories. You'll need to specify a bucket name in the command below as . Buckets have globally unique names and are owned by unique users. If you have used S3 before, you can use any of your existing buckets or just give ec2-upload-bundle any name that makes sense to you. The ec2-upload-bundle utility will upload the bundled AMI to a specified bucket. If the specified bucket does not exist it will create it. If the specified bucket belongs to another user ec2-upload-bundlewill fail, and you will have to try a different name.

For this step you'll need your AWS Access Key ID () and AWS Secret Access Key (). The steps to find these were covered in the section called “Signing up for Amazon S3”.

The upload process can be quite lengthy, but you will get continuous feedback until the upload has completed:

# ec2-upload-bundle -b -m /mnt/image.manifest -a -s

Encrypting bundle manifest...
Completed encryption.
Uploading encrypted manifest...
Uploaded encrypted manifest to
Uploading bundled AMI parts to
Uploaded 00 to
Uploaded 01 to
Uploaded 02 to
Uploaded 03 to
Uploaded 23 to
Uploaded 24 to
Upload Bundle complete.

Share this page:

0 Comment(s)

Add comment


From: enomaly at: Nov 24, 2006