Last active
May 15, 2018 15:35
-
-
Save vancluever/2ee0cbea6c6b41993581 to your computer and use it in GitHub Desktop.
AWS region/availability zone one-liners (from running instance)
This file contains hidden or 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
# One can get the availability zone easily from within an AWS EC2 instance: | |
AVAILABILITY_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
echo $AVAILABILITY_ZONE | |
# Take that a step further, and you can get the region easily by just chopping | |
# the last character off. | |
REGION=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/.$//g'` | |
echo $REGION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment