Skip to Content
Asterrr's Handbook
4 · Identity and access management

Policy evaluation logic

How AWS decides allow or deny, the order of checks, same-account versus cross-account, and which policy types can override each other.

Exam tasks: 4.2 (Skills 4.2.1 authorization controls and resource policies for cross-account access, 4.2.3 interpret and implement least-privilege policies, 4.2.4 analyze authorization failures)

The decision: given every policy that touches this request, is there an explicit deny, and if not, does each layer that must allow it actually allow it?

Three rules drive every answer. Requests are implicitly denied by default. An explicit deny always wins. Guardrails (RCP, SCP, boundary, session policy) never grant, they only intersect.

noneallowallowRequest1 Deny?2-3 RCP, SCP4-5 Resource,identity6-7 Boundary,session
Order of checks inside one account. Any explicit deny ends the request first. Each later box must allow or the result is an implicit deny.

Evaluation steps

StepCheckFailure result
1Any applicable Deny in any policy typeDeny
2RCPs on the resource owner account. RCPFullAWSAccess is attached by defaultImplicit deny without an allow
3SCPs on the principal account. FullAWSAccess is attached by defaultImplicit deny without an allow
4Resource-based policyCan allow on its own, see the table below
5Identity-based policyNo allow here means implicit deny
6Permissions boundaryNot allowed means implicit deny
7Session policy, for role sessions and federated usersNot allowed means implicit deny

Evaluation flow

yesnonoyesnoyesyesnonoyesset, doesn't allownot set, or allowspassed, doesn't allownone, or allowsRequest arrivesExplicit Deny in anyapplicable policy?DenyRCPs on the resource'saccount allow it?Implicit denySCPs on the caller'saccount allow it?Implicit denyResource policy allowsthis exact session oruser? (same account)AllowIdentity policy allows?Implicit denyPermissions boundary set?Does it allow?Implicit denySession policy passed?Does it allow?Implicit denyAllow
Decision tree for the evaluation flow
  • Explicit deny is checked across everything first. A deny in an SCP, RCP, bucket policy, boundary or session policy ends it. No allow anywhere can override it.
  • Guardrails need an allow too. SCPs and RCPs start with the AWS managed FullAWSAccess and RCPFullAWSAccess policies. If you detach FullAWSAccess without adding your own allows, member accounts can do nothing. RCPFullAWSAccess can't be detached.

Exam signal

"Access denied despite an Allow in the IAM policy" or "the user has AdministratorAccess but still gets AccessDenied" means check, in order, explicit deny, RCP, SCP, permissions boundary, session policy, the resource policy of the other account, and VPC endpoint policy. The error message usually names the policy type, as covered in access analysis. Use sts:DecodeAuthorizationMessage to see which kind of deny it was.

Same account: does a resource policy bypass the caps?

Resource policy namesIdentity policy missingBoundary or session policy missing the action
IAM user ARNStill allowedBoundary is bypassed
Role ARN (or aws:PrincipalArn)Still allowedBoundary and session policy still limit it
Assumed-role session ARNStill allowedBoth bypassed
Federated user session ARNStill allowedBoth bypassed
Wildcard principal with aws:PrincipalArn conditionStill allowedNot limited unless an identity policy explicitly denies

Explicit denies in a boundary, session policy or SCP always apply.

Exam trap

Role trust policies and KMS key policies are exceptions to the "either policy is enough" rule. They must explicitly allow the principal, so an identity policy alone does not open a KMS key or let a principal assume a role. An identity policy with kms:* does nothing if the key policy doesn't delegate to IAM.

Cross-account access

Two evaluations run, one per account, and both must allow.

Account A (trusted)Account B (trusting)permitsPutObjectcapsDemo roleIdentity policyallowsBucket policyallows DemoSCP and RCP of B
Cross-account request. The identity policy in the trusted account and the resource policy in the trusting account must both allow.
QuestionAnswer
Resource policy in B names account A root onlyA identities still need their own identity policy allow
Identity policy allows but B has no resource policyDenied
Cross-account role assumption insteadRole trust policy in B plus sts:AssumeRole allowed in A. After assuming, the caller acts as a B principal
Whose SCP appliesThe SCP of the principal account. The RCP of the resource account
ACLsGrant only to other accounts, never to the same account

Same account versus cross-account

Same accountCross-account
Needs an allow inIdentity policy or resource policyIdentity policy and resource policy
SCPs fromThat accountThe caller's account
RCPs fromThat accountThe resource owner's account
Alternativen/aAssume a role in the resource account, so the request becomes same-account
  • Services without resource policies (most of EC2, for example) can only be reached cross-account by assuming a role in the owning account.
  • With a resource policy, the caller keeps its own identity, so CloudTrail in the resource account records the external principal, and the caller doesn't give up its own permissions.

Only fixing one side

A partner account gets AccessDenied on your bucket even though your bucket policy names its role. The partner still needs an identity policy in its own account that allows the action on your bucket ARN, and its SCPs must allow it. Editing your bucket policy again won't help.

Scenarios

Scenario
A data team in account 3333 runs a role, orbit-analytics, that must read objects from the bucket tidal-exports in account 4444. The bucket policy in 4444 allows s3:GetObject for the orbit-analytics role ARN. Requests still fail with AccessDenied, and the error says no identity-based policy allows the s3:GetObject action. What fixes it with the least change?

Further reading

On this page