Todd Pinkerton

Rails on Amazon’s elastic computing cloud

Categories: rails, scalability
Written By: todd

amazon has recently announced their Elastic Computing Cloud service. It gives users the ability to quickly create a virtual machine in amazon’s datacenter, install whatever OS they want, and use it for whatever — webserver, cracking crypto, etc. The idea is to make scaling your application easy as demand increases. Instead of buying/installing/maintaining additional servers, you can just pay for a few hours of EC2 time. For now, the EC2 service is in beta, and invite-only.
You can bring up many identical machines quickly, using an AMI image you create.The catch is that you must persist all your data before taking down your virtual instance — the filesystem it provides gets destroyed whenever you reboot or stop running the instance, so you need to save your data off to the S3 storage service. There is some up-front work to be done once you get an account and begin using the EC2, however. Amazon provides a small selection of basic disk images, but to do anything useful you’ll need to install your own software. I wanted to try running Ruby on Rails in this environment, so I create an AMI with all the software I needed and saved it to the S3 storage. Now whenever I need a new RoR machine, I run a single command to tell EC2 to create a new instance of that AMI, and in a few minutes it’s ready.

I followed the instructions here for upgrading the default image to Fedora Core 5, and then these instructions to install ruby, rails, and mongrel, for a complete RoR setup.
I’m trying to figure out how to share this AMI with others, so they can use it without going through all the bother that I did setting it up. The obvious thing is to download the image from S3, create a torrent, and share that. But ideally we’d be able to allow others to access our S3 storage, since that’s where users would have to upload the image to anyway. If anyone has an idea on how to do this, let me know.

One Response to “Rails on Amazon’s elastic computing cloud”

  1. David Says:

    Here is how you share your AMI

    http://developer.amazonwebservices.com/connect/entry.jspa?externalID=530&categoryID=100

Leave a Reply