Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 setting up an Ubuntu instance on Amazon EC2 and I'm trying to configure it so that, at startup, it automatically attaches an EBS volume and takes an elastic IP address and, at shutdown, it automatically releases those resources.

I found various init scripts that do what I want, but I'd really like to use an upstart job, so that I can automatically install it through cloud-init.

I understand from this exchange that the event I want to monitor to start my job is, for lucid and maverick

start on stopped cloud-run-user-script

and for natty

start on stopped cloud-final

Is this really accurate? Also, what is the correct event to monitor to stop my job (including unmounting and detaching the EBS volume and releasing the elastic IP)?

share|improve this question
start on stopped cloud-final still works on saucy – Luke Chadwick Mar 12 '14 at 2:44
up vote 2 down vote accepted

The events are correct if you specifically need to run when cloud-init has finished. You probably will want your script to be done with the keyword task, so that the bits that depend on cloud-init are blocked until your script finishes.

For shutdown

start on runlevel [016]

Will run something as the normal system shutdown is happening.

Note that there's a wealth of information about these things in the upstart cookbook:

share|improve this answer
Thank you. I didn't notice the cookbook in my searches... – tawmas May 18 '11 at 11:37

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.