Search My Blog

Sunday, October 31, 2010

How to convert VMDK virtual hard disks to Amazon Elastic Compute Cloud (EC2) AMI format

How to convert VMDK virtual hard disks to Amazon Elastic Compute Cloud (EC2) AMI format

Let me introduce the Amazon Elastic Compute Cloud (EC2) concept for a few moments:

Amazon EC2 is a web service designed to provide instantly resizable, scalable computing capacity to users around the world. It's a massive virtualization grid, located within the massive Amazon farms, providing CPU cycles and hard disk space to whoever may require them, on the fly. The only thing you have to do is pay, and not that much actually.

To be actually useful, Amazon provides the service with a very affordable price tag, comparable to what you may have to spend on buying and maintaining your own infrastructure. For home users, this may not seem like the most immediate necessity, but small to medium businesses with flexible demands will definitely like the prospect of hardware independent freedom.


Some of you will like the idea, some of you will hate it. Personally, I think this is a great project, especially since the Amazon cloud is based on Linux and mainly support Linux, creating a tremendous opportunity for the Linux market growth. Mark Shuttleworth suffered quite a bit of criticism for his intention to incorporate Amazon functionality into the upcoming Ubuntu release, but I think it's a wise step, as the merging of needs between the desktop and the Web beckons for an "ethereal"  flexibility only available in the Cloud.

At home ...

At home, you will rarely need more than classic virtualization provides. But you will probably start considering Amazon whenever the price tag of having your own database server with 16GB RAM in the living room comes up.

If ever that happens, you will want to know how to use the Amazon EC2. A full tutorial is definitely beyond the scope of this article; you have the official documentation for that.

Instead, I'm going to demonstrate but a part of the whole scheme, albeit probably the most important one that the home user might come across - the creation of Amazon virtual machine images. I'm going to show you how to convert home-brewed virtual hard disks used by VMware products into Amazon-compatible images that you can use with EC2.

Why not create Amazon images in the first place or use existing builds?

A good question! Amazon allows you to create images from scratch or use one of the existing templates (like SUSE, Ubuntu, RedHat, etc) as your starting point. However, creating images is a tad complicated. And using existing templates might not be what you want. For example, you may want to run a special, custom-configured distro or you may want to use a private, digitally-signed image that is unavailable to anyone but you.

You want total control and you can't afford to let others create the images for you.

Objective: Create image at home, then upload to Amazon

I'm narrowing down this tutorial to a very specific subject, which I find quite important. You want to have a private image, with its own certificate. You want to create it at home, at leisure, at your own time and expense, without wasting money on bandwidth and the long hours of configurations. Once it's ready, you'll convert it and upload it to Amazon storage, called Amazon Simple Storage Service (S3).

Note: You will have to have a valid Amazon EC2 account before you can put the instructions in this tutorial to any use. Furthermore, you will have to use Linux to follow the tutorial successfully. Certain tools used here are only available for Linux - not surprising, considering that Amazon runs on Linux.

First question: convert from what?

Another good question. There are many desktop virtualization formats available. However, if you run virtualization at home, there is a good chance that you're using one of VMware products. VMware uses the .vmdk format for its virtual hard disks. This is our source format, which we want to convert to Amazon Machine Image (AMI).

However, you cannot directly convert the VMDK virtual disks to AMI. To show you what needs to be done, I've written this tutorial.

Let's begin.

Step 1: Make sure you have EVERYTHING you need

Go there...


No comments: