Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wearing the devops hat for my company. All our infrastructure is manually configured in AWS and I would like to start using Chef for configuration.

First step: Make it easy to bootstrap an environment and reach out to the chef server! Here is my thoughts on how to approach it.

  1. Start a fresh Ubuntu AMI
  2. Add a script that runs at startup the bootstraps an enviro (ruby, ruby gems, etc.) and registers with Chef.
  3. Squirrel away this as a custom AMI so I can start many of these.

So, my question is: What is the best way to go about running a script just once on the next startup?

share|improve this question

Do read the OpsCode wiki. In my opinion, it has too much information for someone to easily lose track.

Your approach should be like this:

Use Knife to launch the fresh Ubuntu/CentOS AMI with the required run list. Your run list is basically roles which contain the cookbooks. Cookbooks contain recipes of what you actually want to automate.

Ideally, you should never create a custom AMI from this chef managed image. Thats the whole point of using these configuration management tools.

share|improve this answer

Have you looked at the Opscode wiki entry on using Chef with EC2?

Basically, you would start up an EC2 instance you can ssh into, then run a knife bootstrap command against it. The knife command will do all that stuff you have in Step 2. You can tweak the knife bootstrap template to specify the Chef recipes/roles you want to apply to the node. You should not need to do Step 3.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.