If the user-data starts with #!, it is assumed that the user-data is a generic shell script, and cloud-init will attempt to execute the data as a script
It looks like the userdata supplied by the user is appended to some auto-generated userdata (probably by ucd?).
A similar problem occurs with #cloud-init. The entire userdata is appended to the end of /var/lib/cloud/aws-user-data.
So in order to run cloud-init style config, the user actually needs to avoid supplying any first line stanza:
According to the docs:
When testing this:
ucd-aws logs shows:
The file looks like this:
It looks like the userdata supplied by the user is appended to some auto-generated userdata (probably by ucd?).
A similar problem occurs with
#cloud-init
. The entire userdata is appended to the end of/var/lib/cloud/aws-user-data
. So in order to run cloud-init style config, the user actually needs to avoid supplying any first line stanza: