Created
December 9, 2015 21:58
-
-
Save jyidiego/1ec3bc3dba60141970b6 to your computer and use it in GitHub Desktop.
Simple script to associate Elastic IP to a EC2 instances in the public subnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REGION=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null) | |
INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null) | |
aws configure set region ${REGION%[a-z]} | |
aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id <allocation id> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment