-
-
Save slmingol/9d02eb39dff4e8da427053a4483d0c12 to your computer and use it in GitHub Desktop.
Use this when Amazon gives you an "Encoded authorization failure message" and you need to turn it into something readable. If you only get a request id... you're out of luck.
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 | |
# REF: https://gist.github.com/xiongchiamiov/b0ef0251813625307371d0e11e131759#file-why-sh | |
# REF: https://bcb.github.io/pipe-jq-to-less | |
function decode-authorization-failure-message { | |
if [ $# -ne 1 ] || [ "$1" = -h ] || [ "$1" = --help ]; then | |
cat <<'EOT' | |
Usage: decode-authorization-failure-message <message> | |
Use this when Amazon gives you an "Encoded authorization failure message" and | |
you need to turn it into something readable. | |
EOT | |
return 1 | |
fi | |
aws sts decode-authorization-message --encoded-message "$1" | | |
jq '.["DecodedMessage"]' | | |
sed 's/\\"/"/g' | | |
sed 's/^"//' | | |
sed 's/"$//' | | |
jq -C '.' | less -R | |
} | |
decode-authorization-failure-message "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment