Created
October 6, 2015 08:54
-
-
Save seventhskye/f0ddf5c83753d024f9ff to your computer and use it in GitHub Desktop.
A script to find the instance-id and region from the metadata of an Amazon based instance.
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 | |
# Get Instance Details | |
INSTANCE_ID=$(wget -q -O- http://169.254.169.254/latest/meta-data/instance-id) | |
REGION=$(wget -q -O- http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/\([1-9]\).$/\1/g') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment