AWS Custom AMI not running userdata script

6,069

As I tested, there were some bootstrap data in /var/lib/cloud directory. After I cleared that directory, User Data script worked normally.

rm -rf /var/lib/cloud/*
Share:
6,069

Related videos on Youtube

jjhughes57
Author by

jjhughes57

Updated on September 18, 2022

Comments

  • jjhughes57
    jjhughes57 over 1 year

    We bake AMI's and lately I have wanted to run some user-data scripts to notify cloud formation when the instance is done booting and put it into service. I am using cfn-signal to do this. On the original ubuntu image the script will execute but after baking our custom AMI the user-data script is not run.

    If I place "#cloud-boothook" at the top of the script it does execute but because it executes so early its not useful for notifying when the machine is up. I am hoping someone knows where the flag or file is that indicates to cloudinit that it is a first boot of a machine.

    I also tried modifying the config as was suggested Here

    I know there must be a flag or file I can remove before the AMI creation process but am unable to find any information on what the flag or file might be.