Comment 0 for bug 1023177

Revision history for this message
Scott Moser (smoser) wrote :

$ ec2metadata --ami-launch-index
0

In EC2 and nova if you launch multiple instances in a single reservation, each has the same user-data, but the metadata service identifies the "launch index" as an integer.

This can be utilized to have instances behave differently, turning one instance into a web server, one into a db server ...

One idea on how to support this in cloud-init would be to add a header field to muliti-part input (both mime and cloud-archive) that indicates that this part only applies to a given launch-index.

Example cloud-archive format:
- type: text/upstart-job
  filename: my-upstart.conf
  launch-index: 0
  content: |
   # upstart job here
- type: text/upstart-job
  filename: my-index2-upstart-job.conf
  launch-index: 1
  content:
   # upstart job here for launch-index 2