Skill 1.1.3

Designing a role-based access control strategy (for example, AWS STS, role switching, cross-account access)

Key Concepts

AWS Security Token Service (STS) issues temporary credentials (access key, secret key and session token) that expire after 15 minutes to 12 hours. AssumeRole is used for cross-account access and role switching; AssumeRoleWithSAML and AssumeRoleWithWebIdentity exchange a SAML assertion or OIDC token for credentials; GetSessionToken returns MFA-backed credentials for an IAM user.

A role has two policies: the trust policy says who may assume it (a principal such as another account, an AWS service or a federated provider), and the permissions policy says what it can do. For cross-account access, create a role in the target account trusting the source account, and allow sts:AssumeRole on that role in the source account. For third parties, require an external ID in the trust policy to prevent the confused deputy problem.

Role switching in the console lets a user move into a role in another account without separate credentials. In multi-account organisations, IAM Identity Center permission sets create these roles in each account for you.