Skip to Content
Asterrr's Handbook
Service cheat sheetsSecurity and identity cheat sheets

IAM and STS fundamentals

Identity types, policy evaluation order, STS credential APIs and IAM quotas in one place.

IAM controls who is authenticated and what they may do. STS issues short-term credentials. Both are free and neither is Regional in the usual sense for IAM resources, since users and roles are global.

AssumeRoleAssumeRoleWithSAMLWithWebIdentitytemp credentialsIAM user or roleSAML IdP userWeb identityuserAWS STSIAM role
Four ways to reach temporary credentials from STS, depending on where the caller was authenticated.

Identity types

IdentityFacts
Root userFull access. Lock away its keys and protect with MFA.
IAM userNew users have no permissions. Long-term credentials. Global.
GroupHolds users only. Cannot contain groups. Has no credentials.
RoleNo long-term credentials. Assumed for temporary access.
Service role / service-linked roleRole a service assumes for you. Service-linked roles are predefined by the service.
Instance profileContainer that passes a role to an EC2 instance.
IAM Roles AnywhereOn-premises workloads get temporary credentials using X.509 certificates from a trusted CA.
Identity Center permission setProvisioned as an IAM role in each assigned account.

Policy evaluation

  1. Everything is denied by default.
  2. An explicit allow in a permissions policy overrides the default.
  3. A permissions boundary (and SCP) must also allow the request.
  4. An explicit deny in any policy wins.

Identity-based policies serve same-account access. Resource-based policies grant cross-account access. A role trust policy is a resource-based policy that says who may assume the role. Resource-based policies are inline only.

STS APIs

APICallerUse
AssumeRoleIAM credentialsCross-account access, optional MFA, session policies and tags.
AssumeRoleWithSAMLUnsigned call from SAML-authenticated userEnterprise federation.
AssumeRoleWithWebIdentityUnsigned call with OIDC JWTCognito, Google, Login with Amazon, GitHub.
GetSessionTokenIAM userMFA-protected API calls. Root sessions are limited to one hour.
GetFederationTokenIAM userProxy brokers. Default 12 hours, up to 36 hours.

Limits worth knowing

ItemValue
Role session15 minutes up to the role maximum of 1 to 12 hours. Default 1 hour.
Customer managed policy size6,144 characters (white space not counted)
Inline policy totalUser 2,048, group 5,120, role 10,240 characters
Roles per account1,000 default, adjustable to 10,000
Managed policies per role20 default, adjustable to 25
Session policyOne JSON document, up to 10 managed policy ARNs, 2,048 characters combined
Session tagsUp to 50
STS requests600 per second per account per Region for credentialed calls

Access Analyzer validates policies while you write them and watches for external access to S3 buckets, KMS keys, SQS queues, IAM roles, Lambda functions and Secrets Manager secrets.

Exam signal

"Temporary credentials for a mobile app" is web identity federation through Cognito. "Cross-account access with MFA" is AssumeRole with MFA in the call.

Exam trap

A permissions boundary never grants access. It only caps what the identity policy can grant. Session policies work the same way, as an intersection with the role policy.

Cognito, Organizations reference

Further reading

On this page