I am trying (without success so far) to run a user-data script on first boot of a Tomcatstack AMI EC2 instance.
I've tried with a simple script, which is successfully executing with Amazon and Ubuntu AMIs.
EC2 defines the ability for the user to pass user defined data to the AMI.
Some AMIs check this data on first boot, and execute it as a script only if it starts with "#!".
This is extremely useful, since it allows customizing the standard AMI on first boot, for example to install the CloudFormation scripts, or some other deployment tool (puppet, chef, etc.).
It works, for example, with the Canonical Ubuntu Server 12.04.1 AMI, but unfortunately not with the Bitnami TomcatStack AMI (at least not the version i'm using for my webapps).
Depending on how Bitnami creates it's AMIs, this might make sense, or not.
Hence, the question becomes:
How can i execute a script on first boot on a Bitnami AMI?
- Using ssh
- Rebundling the instance