Similar to this question,

My user data is:

echo 'test' > /home/ubuntu/user-script.txt
Using a standard Ubuntu AMI, this works fine.

I have a custom AMI that I have created by standing up a standard Ubuntu AMI, running an Ansible playbook and creating an AMI from that. When I configure my launch config to use my custom AMI, user data is NOT run. There is no other difference.

I understand that it may be due to the semaphore files so I stood up an instance of my AMI, deleted /var/lib/cloud/sem/* and created a new AMI. I created a new launch configuration with this AMI and got the same result.

I repeated this process, this time removing /var/lib/cloud/*. Same result.

Any ideas? This has got to be possible, right?


I have found the cause of this.

My Ansible playbook was removing a package from Ubuntu called "unattended-upgrades" which presumably the Amazon utilities use.

Likewise, my second playbook was removing the ubuntu user. The Amazon utility may also use that.

When I disable these roles, the AMI works with user data as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.