Created
August 26, 2023 00:26
-
-
Save crabba/389749bc8b7307a44aac87fe36c46165 to your computer and use it in GitHub Desktop.
Detect OS and set useful variables
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 | |
# Detect OS and set useful environment variables | |
# Sets: | |
# AWS_ACCOUNT_ID | |
# AWS_REGION | |
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") | |
curl http://169.254.169.254/latest/meta-data/profile -H "X-aws-ec2-metadata-token: $TOKEN" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment