Sunday, November 07, 2010

Public Mandriva 2010.1 AMI now available on Amazon EC2

After some work, I’ve created a Mandriva 2010.1 AMI instance on Amazon’s EC2 service. I’ll go into detail of how I created it, but for the impatient, you can now boot a Mandriva 2010.1 i386 Amazon virtual machine, setup with a base Mandriva install. The AMI ID is: ami-62e2150b and the name is “mandriva-2010.1-go”. You can find this image in the list of public AMI’s on Amazon if you search for mandriva. The smallest machine Amazon provide costs only around 2 cents per hour, if you just want to play with it.
Getting down to how I actually created this, is a little more interesting. Amazon now provide two things that make building your own machine on Amazon easier. The first is a think called EBS, which is basically the ability to create block devices and give them to the OS, they are persistent storage and reasonably fast. The second is that Amazon now have a thing called PVGRUB. This lets it boot any standard kernel that supports running as a Xen guest. (dom U).
To build the one I have made public, I started with an install of Mandriva inside a virtual machine I created, by using the normal installer and unselecting everything except the base and urpmi. I then booted an existing Amazon machine that was running a different version of Linux. I attached another EBS disk to the machine, made a file system and used rsync to copy all the files from my vm (which had been shutdown), onto the EBS storage at Amizon. After that, I adjusted /boot/grub/menu.1st and fstab, then switched my EBS storage devices around to boot from the Mandriva one I has just created. I then added an appropriate script to /etc/rc.d/rc.local to install the appropriate ssh key on boot when I make it public, and created a snapshot of the EBS decive. From this stapshot, I was able to create the AMI ( using ec2-register), which clones the snapshot every time someone creates a virtual machine based on the snapshot.
I can create the EBS ami with whatever size disk I want, as I setup the image to run a resize2fs on first boot to grow from the 2GB snapshot to whatever size people want. The public one I created has a 4GB disk to start with.

2 comments:

Anonymous said...

Would you mind to add a title to your recent posting?

Glen said...

Sorry about the missing title. It seems that blogger.com decided to change the layout settings without asking me, and set the title to hidden.