AWS CLI IAM and STS Cheat Sheet/Request a session token

Get temporary credentials for an IAM user.

Section: STS Identity and Sessions

Request a session token

bash
bash
aws sts get-session-token --duration-seconds 3600
Explanation

Often used with MFA-enforced IAM user workflows.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing STS Identity and Sessions
Get caller identity
Show the current principal, account, and ARN.
OpenIn sheetbashsame section
Assume a role
Obtain temporary credentials for another role.
OpenIn sheetbashsame section
Assume role with web identity
Obtain credentials from a web identity token.
OpenIn sheetbashsame section
List IAM users
Show IAM users in the account.
OpenIn sheetbash1 tag match
List managed policies
Show AWS-managed and customer-managed policies.
OpenIn sheetbash1 tag match
List roles
Show IAM roles in the account.
OpenIn sheetbash1 tag match