The Cult of Gary

18 Jun

Renaming EC2 Instances

I used to rename my EC2 instances. That is, I would manually set the HOSTNAME variable in /etc/sysconfig/network. I usually didn’t have that many running, maybe two or three. Not everything was automated, so it was definitely helpful to see my hostname in the bash prompt instead of Amazon’s. Amazon’s hostname is based on the IP address.

My procedure for bringing up an instance used to go something like this:

  1. Start the base Rightscale CentOS image
  2. Log in, change the hostname and reboot
  3. Log in again, install puppet
  4. Sign the server key on the puppet server
  5. Wait for puppet to work its magic

I could roll an instance in 5 to 10 minutes. If I was starting up more than 1, I could do it faster as I rolled through.

Last week, I decided it was time to stop renaming my instances and build my own AMI. I wish I’d done it sooner. It now takes me about a minute to fire up an instance.

My AMI is the Rightscale image with puppet pre-installed and pre-configured to connect to my puppet server. Now my procedure looks like:

  1. Start an instance
  2. Sign the server’s key with puppetca

That’s it. After a few minutes, puppet has molded the instance for me and I can add it to clusters or do any other manual tasks.

I’m still editing puppet files by hand. I think my next improvement will be toget iClassify going and make it talk with puppet.

3 Responses to “Renaming EC2 Instances”

  1. 1
    Tech Messages | 2008-07-10 | Slaptijack Says:

    [...] Renaming EC2 InstancesI’m fascinated with everything relating to Amazon’s EC2 and S3 services. [...]

  2. 2
    Jauder Ho Says:

    Gary,

    Is your AMI available to be shared with others for reuse? Thanks.

  3. 3
    gary.richardson Says:

    No, it’s got a few other custom things in it.

    It’s really easy to build an AMI. Basically, start an existing one up, make your changes and run the AMI building script.

Leave a Reply

© 2012 The Cult of Gary | Entries (RSS) and Comments (RSS)

GPSwordpress logo