Created
May 31, 2024 14:38
-
-
Save sebastianrothbucher/fe4f2790e1a367b65cbd3839c9aa1d6a to your computer and use it in GitHub Desktop.
STS assume role and export creds - use via . shell-helper.inc in bash
This file contains hidden or 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 assumeRoleAndExport { | |
local STS_RES=$(aws sts assume-role --role-arn $1 --role-session-name "whatever-session-$(uuidgen)") | |
export AWS_ACCESS_KEY_ID=$(echo $STS_RES | jq -r .Credentials.AccessKeyId) | |
export AWS_SECRET_ACCESS_KEY=$(echo $STS_RES | jq -r .Credentials.SecretAccessKey) | |
export AWS_SESSION_TOKEN=$(echo $STS_RES | jq -r .Credentials.SessionToken) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment