How can I change the directory that packer runs the AMI provisioning script from /tmp to /opt

2.8k Views Asked by At

I need to change the directory where packer runs the AMI provisioning script from /tmp/packer-shell975270284 because our instances don't allow scripts to be run form /tmp.

This script needs to run in /opt or /home/ec2-user. where it will have permissions

Below is the error that I am getting after the ansible playbook ran.

==> amazon-ebs: Provisioning with shell script: /tmp/packer-shell975270284
Build 'amazon-ebs' errored: Error uploading script: scp: /tmp/script_5412.sh: Permission denied.

==> Some builds didn't complete successfully and had errors.

==> Builds finished but no artifacts were created.
1

There are 1 best solutions below

0
On BEST ANSWER

You need to set the remote_folder to something else rather than /tmp. See the documentation.