Created
September 29, 2022 09:44
-
-
Save jbonachera/57f9c014a1f2254be8a21bdcb7eeaa41 to your computer and use it in GitHub Desktop.
exports AWS credentials environment variables from STS cli call
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
aws_assume(){ | |
aws sts assume-role --role-arn $1 --role-session-name debug --duration-seconds 900 | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=" + .AccessKeyId + "; export AWS_SECRET_ACCESS_KEY="+.SecretAccessKey + ";export AWS_SESSION_TOKEN="+.SessionToken' | |
} | |
# Usage: eval $(aws_assume arn:aws:iam::${AccountId}:role/${RoleName}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment