Skip to content

Instantly share code, notes, and snippets.

@tsaito-cyber
Created August 20, 2021 15:51
Show Gist options
  • Save tsaito-cyber/23fed27403da120058871ff845817232 to your computer and use it in GitHub Desktop.
Save tsaito-cyber/23fed27403da120058871ff845817232 to your computer and use it in GitHub Desktop.
assume_role.sh
#!/bin/bash -xe
role_arn="$1"
eval $(aws sts assume-role --role-arn "$role_arn" --role-session-name $RANDOM | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)\nexport AWS_SESSION_TOKEN=\(.SessionToken)\n"')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment