Packer - Assign specific Elastic IP to instance

2019-08-06 03:07发布

问题:

When I fire up an EC2 instance with Packer, in order to create an AMI, is there a way to assign it a specific elastic IP address, assuming I already own that IP address?

回答1:

I would use the Shell Provisioner to run a simple to script, uploaded with the File Provisioner to your Packer instance. The script would utilize the AWS CLI calling associate-ipaddress for this instance.