Last active
July 17, 2024 22:07
-
-
Save pkqk/7ce9a6a7808604f2a32f5f70f555b2ba to your computer and use it in GitHub Desktop.
AWS IMDSv2 function
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
function imds () { | |
local u="$1" | |
shift | |
curl -f -s -w "\n" -H "X-aws-ec2-metadata-token: $(curl -s -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" "http://169.254.169.254/latest/api/token")" "http://169.254.169.254/${u}" "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment