Last active
February 6, 2020 03:49
-
-
Save KyMidd/2941e6220ccb22443b3254e5cbb8bb60 to your computer and use it in GitHub Desktop.
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
# Clean variables | |
unset AWS_ACCESS_KEY_ID | |
unset AWS_SECRET_ACCESS_KEY | |
unset AWS_SESSION_TOKEN | |
unset ACCOUNT_ID | |
# Call for ACCOUNT_ID | |
curl -s http://169.254.169.254/latest/meta-data/identity-credentials/ec2/info | jq -r '.AccountId' | awk '{print "export", "ACCOUNT_ID="$0}' > variables | |
# Call for INSTANCE_ID | |
curl -s http://169.254.169.254/latest/meta-data/instance-id | awk '{print "export", "INSTANCE_ID="$0}' >> variables | |
# Read account ID variables into global | |
. ./variables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment