background preloader


Facebook Twitter

Bootstrapping EC2 instances with Chef. This is the third installment of my Chef post series (read the first and the second).

Bootstrapping EC2 instances with Chef

This time I'll show how to use the Ubuntu EC2 instance bootstrap mechanism in conjunction with Chef and have the instance configure itself at launch time. I had a similar post last year, in which I was accomplishing a similar thing with puppet. Why Chef this time, you ask? Although I am a Python guy, I prefer learning a smattering of Ruby rather than a proprietary DSL for configuration management. Also, when I upgraded my EC2 instances to the latest Ubuntu Lucid AMIs, puppet stopped working, so I was almost forced to look into Chef -- and I've liked what I've seen so far. Here is a high-level view of the bootstrapping procedure I'm using: 1) You create Chef roles and tie them to cookbooks and recipes that you want executed on machines which will be associated with these roles.2) You launch an EC2 Ubuntu AMI using any method you want (the EC2 Java-based command-line API, or scripts based on boto, etc.).

Creating an EBS-backed AMI from an S3-backed AMI. The recent introduction of Boot From EBS for EC2 opens up a lot of new possibilities.

Creating an EBS-backed AMI from an S3-backed AMI

But there are some bootstrapping issues to deal with. There aren't many EBS-backed AMI's available yet and, given the rather complex process involved in porting them, it may take a while for them to show up. This article will walk through the process of converting a popular S3-based AMI to an EBS-backed AMI. I don't guarantee that this is the best process and I certainly wouldn't recommend that anyone use the resulting EBS-backed AMI for anything other than testing and further development, but it puts a stake in the ground regarding a potential process. I'm sure I will hear about the shortcomings and possible improvements! As a starting point, I'm going to use one of Eric Hammond's excellent Ubuntu AMI's. Ami-eef61587 alestic-64/ubuntu-9.04-jaunty-base-64-20091011.manifest.xml This same basic process should work for other Linux-based AMI's. Index of /releases. Ubuntu Cloud Images (RELEASED) Ubuntu Cloud Images are pre-installed disk images that have been customized by Ubuntu engineering to run on cloud-platforms such as Amazon EC2, Openstack and LXC.

Index of /releases

For more information, please see the following: Release Images The following directories contain the official released Ubuntu Cloud Images. Name Last modified Size Description Parent Directory - 10.04 LTS (Lucid Lynx) Daily Build. The Ubuntu Cloud image can be run on your personal Ubuntu Cloud, or modified, rebundled and uploaded to Amazon EC2.

10.04 LTS (Lucid Lynx) Daily Build

For further instruction on setting up a personal Ubuntu Cloud, see Getting Started with Ubuntu Cloud There are two images available, each for a different type of computer: 32-bit Cloud image For almost all PCs. This includes most machines with Intel/AMD/etc type processors and almost all computers that run Microsoft Windows, as well as newer Apple Macintosh systems based on Intel processors. 64-bit Cloud image Choose this to take full advantage of computers based on the AMD64 or EM64T architecture (e.g., Athlon64, Opteron, EM64T Xeon, Core 2). Amazon EC2 Published AMIs The images have been published to Amazon EC2, and can be used immediately with no need to download anything. A full list of available files can be found below. Name Last modified Size Description Parent Directory - Current Released Image.