Skip to content

Instantly share code, notes, and snippets.

@Edison-Hsu
Created November 17, 2022 14:21
Show Gist options
  • Save Edison-Hsu/3dc918c6e2a60189ffa5c686a2b9776e to your computer and use it in GitHub Desktop.
Save Edison-Hsu/3dc918c6e2a60189ffa5c686a2b9776e to your computer and use it in GitHub Desktop.
assume a role in one line command
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s" \ $(aws_prompt_info)
$(aws sts assume-role \
--role-arn arn:aws-cn:iam::xxxx:role/xxxx \
--role-session-name MySessionName \
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \
--output text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment