简体   繁体   中英

How to avoid packer from assigning public ip to ami

I want to associate an EIP with the ec2 instance that packer creates when we run 'packer build' command. I am setting the "associate_public_ip_address": "false",

and trying to associate EIP by providing 'aws ec2 associate-address --allocation-id' in the 'user_data' of the packer json. Still whenever Packer is creating an ec2 instance for the AMI, its automatically assigning a random public IP. I want to know how to prevent Packer from assigning this random public IP to the ec2 instance.

Subnet auto assign public IP was assigning the IP, irrespective of the above settings. Turning that off from the subnet settings resolved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM