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
$ 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: upstart- job.conf
- type: text/upstart-job
filename: my-upstart.conf
launch-index: 0
content: |
# upstart job here
- type: text/upstart-job
filename: my-index2-
launch-index: 1
content:
# upstart job here for launch-index 2