Topic lessonTopic: IAM: roles and permission limits
How AssumeRole works: trust policies, permissions and sessions
AssumeRole lets a caller obtain temporary credentials for a session of an IAM role. Permission to assume the role and permission to perform a later operation are evaluated as different requests. Follow a fictional document app that assumes a ReportReader role in another account to read a report.
Identify the caller, target role, trust, caller-side permission and session, then distinguish an AssumeRole failure from denial of a later operation.
Know IAM authentication/authorization and Action, Resource and Effect. A principal makes a request; an ARN identifies an AWS resource or identity; STS is the Security Token Service that issues temporary credentials. All examples are synthetic; no login or API call is performed.
Separate role assumption from the later operation
A role is an IAM identity with permissions; a role session is a temporary principal using that role. The app uses its existing credentials for the STS AssumeRole request. After success, a request signed with the returned credentials is made as a session of the target role.
Request 1: assume the role
Calls with an existing role session in account A. Its permissions are not added to the later session.
sts:AssumeRoleTarget: ReportReaderAn IAM role in account B. Its trust policy identifies who may assume it.
- A: permission to assume the target, plus applicable limits
- B: trust in the caller, plus conditions
Request 2: read the report as the session
The principal using temporary STS credentials, subject to expiration and applicable limits.
s3:GetObjectTarget: monthly reportThe later request is s3:GetObject. Review resource and applicable controls as well as role permissions.
Session permissions, target resource and applicable limits—not the sum of the original app’s permissions.
Cross-account example: who authorizes what?
The document app in A requests sts:AssumeRole for ReportReader in B. In this example, B delegates trust to account A, while A grants the app role permission to assume that specific target. Trust in A does not automatically make the role usable by everyone in A.
| Where to look | What to read in this example | What this alone does not establish |
|---|---|---|
| App permissions in A | Does sts:AssumeRole cover ReportReader in B? | Whether B trusts that caller |
| Trust policy in B | Do the trusted Principal and conditions match? | Whether later S3 operations are allowed |
| Other applicable controls | Explicit Deny, SCPs, boundaries and session limits | Whether one Allow establishes final access |
Choose an option to see the result and explanation.
Avoid a universal “two Allow policies” rule
| Configuration | How to read permission | Conditions to retain |
|---|---|---|
| Cross-account delegation | Check target trust and caller permission for that role | Also evaluate applicable Deny, limits and conditions |
| Same account; trust delegated to the account | Delegate AssumeRole permission to the caller | Account trust is not a grant to every identity |
| Same account; IAM user ARN directly trusted | A trust-policy grant can make an extra identity Allow unnecessary | Keep user/role/session distinctions and applicable limits |
An account Principal, such as arn:aws:iam::111122223333:root, delegates to that account; it does not mean only its root user. The number is illustrative. Broadening Principal to * is not a troubleshooting step in this lesson.
Choose an option to see the result and explanation.
After success: request as the session, without adding original permissions
After successful assumption, the app requests s3:GetObject as a ReportReader session. Permissions from the original app role are not automatically added. Consider role permissions, any passed session policy, boundary, SCP and resource-based policy as applicable. S3 encryption and other access controls can also matter.
A session policy restricts the permissions provided through a session; it cannot add permissions beyond the role’s identity policies. Resource-policy grants directly to a same-account session have different evaluation rules, however. Identify the recipient ARN rather than forcing every possible grant into one intersection formula.
Temporary credentials expire. Ordinary AssumeRole is subject to the target role’s maximum session duration and other limits. CLI/API role chaining, where role credentials assume another role, is limited to one hour. Successive console Switch Role actions are authorized with the original credentials, so they are not the same flow.
Choose an option to see the result and explanation.
When denied, identify which request failed
- Fix the attempt, time, caller and target role; distinguish failure of AssumeRole from failure of the later S3 operation.
- For AssumeRole, inspect the trust Principal/conditions, caller permission for the target and applicable restrictions.
- After assumption, identify the session actually used, action/resource, expiration and role/resource permissions.
- If trust requires MFA (multi-factor authentication) or ExternalId, check the request’s conditions; do not remove the control for a test.
- Do not submit real data here. Have an authorized administrator distinguish evidence from unknowns in approved records.
Choose an option to see the result and explanation.
Check, then explain in your own words
- Explain the caller, target role and two requests.
- Distinguish account delegation from a directly named principal.
- Check session operations, expiration and applicable limits.
- Identify the denied request and separate causes from unknowns.
Check your understanding: Does successful AssumeRole prove that reading the report will succeed?
No. The later s3:GetObject is a separate request made by the role session.
Trust governs assumption, while permissions and other applicable controls govern later access. Match the actual principal, resource and restrictions to each request.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- IAM rolesChecked:
Scope and conditionsIAM role identity, trust, temporary credentials; role versus session.
Used in this lessonSeparate role assumption from the later operation
- AssumeRole API referenceChecked:
Scope and conditionsPermissions; same/cross-account trust; temporary credentials; session policies; DurationSeconds/role chaining. No API executed.
Used in this lessonSeparate role assumption from the later operation Cross-account example: who authorizes what? Avoid a universal “two Allow policies” rule After success: request as the session, without adding original permissions When denied, identify which request failed
Scope and conditionsAccount delegation versus root user; IAM role ARN versus role-session ARN; same-account direct grants and wildcard conditions.
Used in this lessonSeparate role assumption from the later operation Cross-account example: who authorizes what? Avoid a universal “two Allow policies” rule
- Cross-account policy evaluationChecked:
Scope and conditionsTrusting/trusted account evaluation; assumed-role session requests are made as a role in the target account.
Used in this lessonSeparate role assumption from the later operation
Scope and conditionsCross-account delegation; no addition of original permissions; console original credentials; ExternalId console limitation.
Used in this lessonCross-account example: who authorizes what? After success: request as the session, without adding original permissions When denied, identify which request failed
Scope and conditionsApplicable request context, explicit versus implicit deny, identity/resource/session evaluation and service exceptions; not a universal union/intersection equation.
Used in this lessonCross-account example: who authorizes what? Avoid a universal “two Allow policies” rule After success: request as the session, without adding original permissions When denied, identify which request failed
Scope and conditionsIdentity permission ceiling; no grant by boundary; same-account user/role/session direct resource grants; explicit deny and NotPrincipal warning.
Used in this lessonAvoid a universal “two Allow policies” rule After success: request as the session, without adding original permissions