a blog about web apps, Lisp, Rails and all the REST ...

Centos 5 AMI for Amazon EC2 install script

Excited about the load balancing, auto-scaling and other new features coming to Amazon EC2?

Here's a script to bootstrap a lean 32bit Centos 5 into m1.small AMI-form for use on EC2. I started with the Rightscale scripts and removed the interactivity and RightScale specifics and added some features: it's using a mirror based yum config to do a base install and I added the same scripts you can find on the Fedora AMI from Amazon itself to update the ec2-ami-tools and kernel-modules. I also included a couple of Dag's packages like dstat and others from RPMForge

Insert your AWS specifics in the top of the file, choose a bucket to store the bundles AMI in, and give your image a nice name. To bootstrap just launch a Fedora 8 instance (use ami-2b5fba42), copy over the script, your certificate and key, and run the script. With some luck - and no boobo on my part - you should see this in your terminal at the end:

Done! Put a fork in it!

Baking the AMI can take a while, so be patient. Afterwards you need to register this AMI so it shows up in your ec2-describe-images -o self command:

ec2-register your-bucket-name/image-name.manifest.xml

This is currently for a 32bit m1.small AMI only, I'm hoping to use some kind of template system to be able to bake a similar script for 64bit and 32bit AMI's alike.

The script:


tags: , , , , ,

3 Responses to “Centos 5 AMI for Amazon EC2 install script”

webmarck says:

This is a great script. Thx so much I found a small problem if I enable the ec2-vmlinuz- kernel the script doesn't install the right modules but still use ec2-modules-2.6.18-xenU-ec2-v1.0-i686.tgz.

Alec says:


Thanks for the script. Came accross one issue. In the script there is a reference to URL . It's there in RightScales Script too. I think it is something specific to rightscale

jeff says:

I noticed the issue regarding the retrieval of an SSH key over HTTP (not SSL!) as well.

Leave a Reply

* required field  ** will not be published