Interview Prep/AWS/IAM Advanced, STS and Multi-Account

How does `sts:AssumeRole` work, step by step?

IntermediateConceptIAM Advanced, STS and Multi-Account
Answer
  1. Caller invokes AssumeRole with the target role ARN and a session name.
  2. STS checks the role's trust policy allows the caller and, cross-account, that the caller's own policy allows sts:AssumeRole.
  3. STS returns AccessKeyId, SecretAccessKey and SessionToken, valid 15 minutes to the role's max session duration (default 1 hour, up to 12).
  4. The caller signs requests with these; CloudTrail logs them with the assumed-role ARN and the session name for attribution.
aws sts assume-role --role-arn arn:aws:iam::222222222222:role/deploy \
  --role-session-name ci-$BUILD_ID --duration-seconds 3600
aws All AWS questions Roadmap: AWS core services

More on IAM Advanced, STS and Multi-Account