AWS EC2 User Data script to allocate Elastic IP
问题 I am attempting to create my own bastion host for a VPC, and created an auto-scaling group with min/max instances of 1. In my launch configurations, I specify the following for the ec2 user data: #! INSTANCE_ID=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id` aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id eipalloc-my-eip-id --allow-reassociation The goal of this user data is to immediately associate an Elastic IP address with my newly created EC2