Today I created an Elastic Computing Cloud image on Ubuntu Feisty and wanted to share some of the oddities, weirdness and coolness that I have experienced along this path of being a guy who created an AMI and made it actually run on EC2.
Amazon has been great lately coming out with such nifty technologies that help startups and the little guy such as Simple Storage Service, Elastic Computing Cloud and Simple Queue Service. The recently released Amazon Flexible Payments Service also seems like a great competitor to Paypal, but I wish it had a non-cobranded version. However, these other services are not the story, but EC2 is.
EC2 is a virtualization technology based on Xen provided by Amazon where you pay per instance hour. That is you pay per the hour that the instance is running. It is great for sites that need to add servers on the fly as load is added. Although it is not cheap as it runs about $70 dollars a month it does provide decent specs for the hardware.
What I realized is that EC2 is more like running a system using a LiveCD then an actual system install. What does this mean? It means that storage is temporary and as soon as the instance is shut down all data is lost. However, if you reboot the instance the files seem to stay alive.
Also most importantly the root filesystem gets very little space. That means you have to work with /dev/sda2 which is usually mounted to /mnt. You are provided with 150gb of space on sda2. I ran into this snafu when I was trying to configure MySQL. Since MySQL uses /var/lib/mysql (on Ubuntu) to store the logfiles I kept on getting "Storage out of space" errors. To solve this I wrote a startup script that moves the mysql files to /mnt.
Uploading a new image was relatively simple, however, I got annoyed that I had to type out the Private Key and Public Key on the command line. Bundling the image itself was relatively straightforward as it was just converting a loopback device.
Creating a Ubuntu image was relatively straightforward especially with these directions and debootstrap taking care of the hard part. Remember to install libc6-xen if you are creating a Linux image. I wish Amazon would be less rpm specific and provide debs for the bundling apps. However, alien was great and got me through the process of installing the files.
Overall, I must say if you are really into creating your own images/distribution that you want to use to run various specific services then EC2 is amazingly efficient at it. Though I wish they would provide state if you want to run a bunch of images to do processing such as video transcoding, Hadoop clusters or mass indexing then Amazon is a gift from the web gods.
Plus I recommend everyone create an image and upload it. I learned quite a bit in the process.
Comments [0]