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.
Evaluation steps
| Step | Check | Failure result |
|---|---|---|
| 1 | Any applicable Deny in any policy type | Deny |
| 2 | RCPs on the resource owner account. RCPFullAWSAccess is attached by default | Implicit deny without an allow |
| 3 | SCPs on the principal account. FullAWSAccess is attached by default | Implicit deny without an allow |
| 4 | Resource-based policy | Can allow on its own, see the table below |
| 5 | Identity-based policy | No allow here means implicit deny |
| 6 | Permissions boundary | Not allowed means implicit deny |
| 7 | Session policy, for role sessions and federated users | Not allowed means implicit deny |
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
FullAWSAccessandRCPFullAWSAccesspolicies. If you detachFullAWSAccesswithout adding your own allows, member accounts can do nothing.RCPFullAWSAccesscan'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 names | Identity policy missing | Boundary or session policy missing the action |
|---|---|---|
| IAM user ARN | Still allowed | Boundary is bypassed |
Role ARN (or aws:PrincipalArn) | Still allowed | Boundary and session policy still limit it |
| Assumed-role session ARN | Still allowed | Both bypassed |
| Federated user session ARN | Still allowed | Both bypassed |
Wildcard principal with aws:PrincipalArn condition | Still allowed | Not 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.
| Question | Answer |
|---|---|
| Resource policy in B names account A root only | A identities still need their own identity policy allow |
| Identity policy allows but B has no resource policy | Denied |
| Cross-account role assumption instead | Role trust policy in B plus sts:AssumeRole allowed in A. After assuming, the caller acts as a B principal |
| Whose SCP applies | The SCP of the principal account. The RCP of the resource account |
| ACLs | Grant only to other accounts, never to the same account |
Same account versus cross-account
| Same account | Cross-account | |
|---|---|---|
| Needs an allow in | Identity policy or resource policy | Identity policy and resource policy |
| SCPs from | That account | The caller's account |
| RCPs from | That account | The resource owner's account |
| Alternative | n/a | Assume 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
Cross-account access needs an allow on both sides, and the error says the caller's identity policy is the missing piece. An RCP never grants anything. An ACL grant is legacy and still wouldn't satisfy the caller-side requirement. Naming the account root only delegates the decision to 3333's IAM policies, which still don't allow the action.
Related
- IAM identities and policy types
- Permissions boundaries and iam:PassRole
- Organizations SCPs, RCPs and declarative policies
- STS, roles and cross-account access
- Access Analyzer, policy simulator and least privilege tools
- SCPs and RCPs
Further reading
Cognito and API Gateway authorizers
Amazon Cognito user pools and identity pools, guest access and token types, and the API Gateway authorizers that check them.
RBAC versus ABAC
When role-based access is enough, how tag-based access control scales with fewer policies, where principal tags come from, and the condition keys that implement it.