Skip to content

Instantly share code, notes, and snippets.

@huslage
Created July 14, 2015 17:27
Show Gist options
  • Save huslage/b3ad0a9877348ce61e32 to your computer and use it in GitHub Desktop.
Save huslage/b3ad0a9877348ce61e32 to your computer and use it in GitHub Desktop.
https://sts.amazonaws.com/?Version=2011-06-15&Action=GetSessionToken&DurationSeconds=3600
export AWS_VPC_ID=$(curl -sq http://169.254.169.254/latest/meta-data/network/interfaces/macs/$(curl -sq http://169.254.169.254/latest/meta-data/mac)/vpc-id)
export AWS_SECRET_ACCESS_KEY=$(curl -sq http://169.254.169.254/latest/meta-data/iam/security-credentials/training_ec2_deploy | jq -r .SecretAccessKey)
export AWS_ACCESS_KEY_ID=$(curl -sq http://169.254.169.254/latest/meta-data/iam/security-credentials/training_ec2_deploy | jq -r .AccessKeyId)
export AWS_SESSION_TOKEN=$(curl -sq http://169.254.169.254/latest/meta-data/iam/security-credentials/training_ec2_deploy | jq -r .Token)
az=$(curl -qs http://169.254.169.254/latest/meta-data/placement/availability-zone)
export AWS_DEFAULT_REGION=${az::-1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment