Last active
December 10, 2018 05:02
-
-
Save rcherara/38451bf843974320f8e9bed6eca935b5 to your computer and use it in GitHub Desktop.
Show Id and region of AWS EC2 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
#!/bin/bash | |
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}') | |
clear | |
echo " The Id of this EC2 Instance is : $instanceId" | |
echo " The Region of this EC2 Instance is : $region" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment