Assume Role with AWSCLI¶
If you have either static or instance profile credentials that grant you STS permissions, then you can gather a set of time-limited role credentials as follows:
```
!/bin/bash¶
TEST_CREDENTIALS=$( \ aws sts assume-role \ --role-arn arn:aws:iam::$AWS_ACCOUNT_ID_1:role/$ROLE_NAME \ --role-session-name $USER \ |jq '.Credentials' )
PROD_CREDENTIALS=$( \ aws sts assume-role \ --role-arn arn:aws:iam::$AWS_ACCOUNT_ID_2:role/$ROLE_NAME \ --role-session-name $USER \ |jq '.Credentials' )
cat >>$HOME/.aws/credentials <