So I\'m trying to use Packer to create an AWS image and specify some user data via user_data_file. The contents of this file needs to be run when the instance boots as it wi
As pointed out by Rickard von Essen the answer was to copy my script to /var/lib/cloud/scripts/per-instance which would execute my script on every instance launched from this AMI.
Alternately you can put your script in /var/lib/cloud/scripts/per-boot if you needed this to happen each time the instance boots.
In my case since I wanted to register the instance with a 3rd party service I only had it execute once per instance creation.