2

I previously asked this question about ordering of init scripts. It turns out that this isn't the solution I need (or possibly even the correct question to ask) - it was phantom success.

My system is an AWS EC2 instance, running upstart(init) 0.6.5 as the boot service.

My goal is to create an AMI that when it boots, uses the instance id to configure other applications that will start during the boot. This is what I would like to happen:

  1. Boot a new instance from an AMI, supplying a script as UserData
  2. The UserData script examines the instance id of the new server, and modifies several configuration files for other applications with the instance id (I'm really just using it as an identifier, nothing too exotic).
  3. AFTER the cloud-init process runs the UserData and modifies the configuration files, then one of my applications starts.
  4. Once the first application is started, several applications (dependent on the first) will then start.

The relevant (I think) start orders of the init files as follows:

  • S50cloud-init-local
  • S51cloud-init
  • S52cloud-config
  • S80my-app-that-needs-to-start-first
  • S81an-app-that-starts-after-the-first-app
  • S81another-app-that-starts-after-the-first-app
  • S98cloud-final

Through some logging, I've only recently learned that it seems that my UserData functionality isn't being executed until S98cloud-final (I had previously thought it was done in S51cloud-init). I don't believe it would be wise for me to move cloud-final earlier in the boot sequence.

I could download and configure all of my apps through the cloud-init process, but I don't want to do that - I'd like to have a preloaded AMI (with all of my applications on it, already configured in init).

I had considered putting the startup for my applications in S99local, but they are applications that should be able to be start/shutdown independently, and I need the init scripts for any subsequent reboots.

What is the best practice for this, or any good suggestions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.