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
Uploading to /var/lib/cloud/scripts/*
will work, but it depends on how you want your images built. Do you need to be able to spin up an instance quickly?
The best solution would be to us Packer provisioners. Provisioners are used to install and configure the machine image after booting by using ansible/salt/puppet/cheff/shell scripts etc, you can provision your image with what ever you need. That way you are not tied down to having to provision deps on each instance launch, which can cause some issues (think intermittent network issues/failures, which could cause some deps not to be installed)
The provisioners for packer are third party u