Created
June 7, 2021 03:33
-
-
Save lrepolho/caa236286e723311daa06c2fba391fe0 to your computer and use it in GitHub Desktop.
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
## MFA Authentication | |
temp_role=$(aws sts get-session-token --serial-number arn:aws:iam::XXXXXXX:mfa/[email protected] \ | |
--token-code 000000) | |
export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq -r .Credentials.AccessKeyId) | |
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq -r .Credentials.SecretAccessKey) | |
export AWS_SESSION_TOKEN=$(echo $temp_role | jq -r .Credentials.SessionToken) | |
## Assume Role | |
export ASSUME_ROLE_ARN=arn:aws:iam::000000:role/foobar | |
temp_role=$(aws sts assume-role \ | |
--role-arn "${ASSUME_ROLE_ARN}" \ | |
--role-session-name "foo") | |
export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq -r .Credentials.AccessKeyId) | |
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq -r .Credentials.SecretAccessKey) | |
export AWS_SESSION_TOKEN=$(echo $temp_role | jq -r .Credentials.SessionToken) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment