Last active
December 21, 2023 08:36
-
-
Save yilas/ae8bc4355e25441b0864dbb8f1e301ed to your computer and use it in GitHub Desktop.
AWS IMDSv2 (token, etc.)
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
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") | |
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ | |
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ami-id | |
## Creds | |
curl -H "X-aws-ec2-metadata-token: $TOKEN" -sS http://169.254.169.254/latest/meta-data/iam/security-credentials | |
curl -H "X-aws-ec2-metadata-token: $TOKEN" -sS http://169.254.169.254/latest/meta-data/iam/security-credentials/test-yann-instanceprofile01|jq | |
export AWS_ACCESS_KEY_ID="ASIA2*REDACTED*" | |
export AWS_SECRET_ACCESS_KEY="mjeIBSgmHz3exX*REDACTED*" | |
export AWS_SESSION_TOKEN="IQoJb3JpZ2luX2VjEIj///*REDACTED*" | |
aws sts get-caller-identity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment