Created
January 31, 2023 19:41
-
-
Save jpriebe/aa437dd34af4684f6a58f1f229bd715c to your computer and use it in GitHub Desktop.
assume_role
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
assume_role () { | |
SESSION_NAME=$1 | |
ROLE_ARN=$2 | |
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s" \ | |
$(aws sts assume-role \ | |
--role-arn $ROLE_ARN \ | |
--role-session-name $SESSION_NAME \ | |
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \ | |
--output text)) | |
aws sts get-caller-identity | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment