INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

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.

What you will learn

Identify the caller, target role, trust, caller-side permission and session, then distinguish an AssumeRole failure from denial of a later operation.

Prerequisite

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.

Two requests: app → STS for assumption, then role session → S3 for reading

Request 1: assume the role

Document app / A

Calls with an existing role session in account A. Its permissions are not added to the later session.

sts:AssumeRoleTarget: ReportReader
ReportReader / B

An IAM role in account B. Its trust policy identifies who may assume it.

Relations to check in this cross-account example
  • A: permission to assume the target, plus applicable limits
  • B: trust in the caller, plus conditions
Only after success: use temporary credentials for a new request

Request 2: read the report as the session

Reader session / B

The principal using temporary STS credentials, subject to expiration and applicable limits.

s3:GetObjectTarget: monthly report
Monthly report in S3 / B

The later request is s3:GetObject. Review resource and applicable controls as well as role permissions.

Evaluated separately from successful assumption

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.

Request 1: hold the action and target role constant
Where to lookWhat to read in this exampleWhat this alone does not establish
App permissions in ADoes sts:AssumeRole cover ReportReader in B?Whether B trusts that caller
Trust policy in BDo the trusted Principal and conditions match?Whether later S3 operations are allowed
Other applicable controlsExplicit Deny, SCPs, boundaries and session limitsWhether one Allow establishes final access

Choose an option to see the result and explanation.

A appears in ReportReader’s trust policy. Does this prove the app can read the report?
Read the answer and reason

Answer: No: assumption conditions and later read permission are separate · Trust governs who may assume the role. This example also needs caller-side AssumeRole permission, and the later s3:GetObject is evaluated separately. Trust is not permission for every S3 action.

Avoid a universal “two Allow policies” rule

Account relationship and Principal selection change the checks
ConfigurationHow to read permissionConditions to retain
Cross-account delegationCheck target trust and caller permission for that roleAlso evaluate applicable Deny, limits and conditions
Same account; trust delegated to the accountDelegate AssumeRole permission to the callerAccount trust is not a grant to every identity
Same account; IAM user ARN directly trustedA trust-policy grant can make an extra identity Allow unnecessaryKeep 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.

A trust Principal is an account ARN ending in root. What does it mean?
Read the answer and reason

Answer: Trust/delegation to that account · An account Principal is not a restriction to the root user. Read delegation, conditions and limits to determine which callers can actually assume the role.

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.

The original app role can delete, but ReportReader only reads. Is delete permission added to this session?
Read the answer and reason

Answer: No: original-role permissions are not added · A request using ReportReader credentials is made as that role session, not with the sum of both roles’ permissions. Any separate resource-policy grant is a different evaluation condition.

When denied, identify which request failed

  1. Fix the attempt, time, caller and target role; distinguish failure of AssumeRole from failure of the later S3 operation.
  2. For AssumeRole, inspect the trust Principal/conditions, caller permission for the target and applicable restrictions.
  3. After assumption, identify the session actually used, action/resource, expiration and role/resource permissions.
  4. If trust requires MFA (multi-factor authentication) or ExternalId, check the request’s conditions; do not remove the control for a test.
  5. 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.

Attempt A fails AssumeRole; a separate attempt B gets an S3 denial. What should you do first?
Read the answer and reason

Answer: Separate attempts/principals and inspect each failed request · Combining separate attempts does not prove success. Match each action, target, principal and time before inspecting grants and restrictions.

Check, then explain in your own words

  1. Explain the caller, target role and two requests.
  2. Distinguish account delegation from a directly named principal.
  3. Check session operations, expiration and applicable limits.
  4. 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.