Trynity Mirell - Ops Witch » Posts » Amazon AMI to VirtualBox - Part One

Trynity Mirell

Amazon AMI to VirtualBox - Part One

One of the things that I’ve been wanting to do for a long time, is to be able to use chef and knife to control not only Amazon EC2 but VirtualBox as well.

While there is vagrant, it’s an entirely different setup that you would use to control the machines. It does integrate chef and puppet, however. So it’s not a lost cause, it’s just not the same.

The support inside the VirtualBox library itself is there, it’s the virtualbox gem that is lacking. With that, fog as well.

Right now, I have knife-ec2 setup to boot an Ubuntu AMI, and load it with a few packages, such as OpenSSH and git. Being able to reproduce this using VirtualBox locally would be a huge step.

Ubuntu has available the cloud images that it uses to create the Amazon AMIs. They consist of several files, but we’re only interesting in the following:

The first step will be converting the raw disk image to something VirtualBox can deal with. Using VBoxManage, we can do this:

VBoxManage convertfromraw   filename outputfile
                            --format VDI|VMDK|VHD
                            --variant Standard,Fixed,Split2G,Stream,ESX
                            --uuid uuid
Google+ for Google Apps