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.
Identity types
| Identity | Facts |
|---|---|
| Root user | Full access. Lock away its keys and protect with MFA. |
| IAM user | New users have no permissions. Long-term credentials. Global. |
| Group | Holds users only. Cannot contain groups. Has no credentials. |
| Role | No long-term credentials. Assumed for temporary access. |
| Service role / service-linked role | Role a service assumes for you. Service-linked roles are predefined by the service. |
| Instance profile | Container that passes a role to an EC2 instance. |
| IAM Roles Anywhere | On-premises workloads get temporary credentials using X.509 certificates from a trusted CA. |
| Identity Center permission set | Provisioned as an IAM role in each assigned account. |
Policy evaluation
- Everything is denied by default.
- An explicit allow in a permissions policy overrides the default.
- A permissions boundary (and SCP) must also allow the request.
- 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
| API | Caller | Use |
|---|---|---|
| AssumeRole | IAM credentials | Cross-account access, optional MFA, session policies and tags. |
| AssumeRoleWithSAML | Unsigned call from SAML-authenticated user | Enterprise federation. |
| AssumeRoleWithWebIdentity | Unsigned call with OIDC JWT | Cognito, Google, Login with Amazon, GitHub. |
| GetSessionToken | IAM user | MFA-protected API calls. Root sessions are limited to one hour. |
| GetFederationToken | IAM user | Proxy brokers. Default 12 hours, up to 36 hours. |
Limits worth knowing
| Item | Value |
|---|---|
| Role session | 15 minutes up to the role maximum of 1 to 12 hours. Default 1 hour. |
| Customer managed policy size | 6,144 characters (white space not counted) |
| Inline policy total | User 2,048, group 5,120, role 10,240 characters |
| Roles per account | 1,000 default, adjustable to 10,000 |
| Managed policies per role | 20 default, adjustable to 25 |
| Session policy | One JSON document, up to 10 managed policy ARNs, 2,048 characters combined |
| Session tags | Up to 50 |
| STS requests | 600 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.
Related
Cognito, Organizations reference