Anatomy of AWS IAM Policy Evaluation Logic, SCPs, Permissions Boundaries & Cross-Account Roles
Understand how AWS computes effective permission intersections and why cross-account S3 requests fail with Access Denied.
Minh Quan Nguyen
Principal Cloud Architect • AWS SAP-C02 • AWS Security Specialty
A single Explicit Deny in any policy layer overrides every Allow statement. Let’s dissect the 5-step AWS IAM evaluation pipeline with real JSON policies.
● KEY TAKEAWAYS & EXAM BLUEPRINT SUMMARY
- 01AWS IAM evaluation always begins with an Implicit Deny. A single Explicit Deny in any policy layer overrides every Allow statement.
- 02Effective Permissions for an IAM Principal equal the logical INTERSECTION (∩) of: Service Control Policies (SCPs) ∩ Permissions Boundary ∩ Identity-based Policy.
- 03Understand the critical difference between Same-Account access and Cross-Account access when combining Identity-based Policies with Resource-based Policies (such as S3 Bucket Policies or KMS Key Policies).
- 04Never hardcode long-lived AWS Access Keys in code or EC2 instances: always attach IAM Roles via EC2 Instance Profiles, ECS Task Roles, or Lambda Execution Roles.
1. The 5-Step AWS IAM Policy Evaluation Order
On both the AWS SAA-C03 and SAP-C02 exams, complex IAM permission evaluation questions separate top scorers from the rest. Whenever a principal sends an authenticated API request to AWS, the IAM enforcement engine evaluates 5 guardrails in strict sequence:
- •Step 1 — Check for an Explicit Deny: If any applicable SCP, Permissions Boundary, Identity Policy, or Resource Policy contains an
"Effect": "Deny"matching the request → Final Deny immediately. - •Step 2 — Evaluate AWS Organizations SCPs (Service Control Policies): If the account belongs to an AWS Organization with SCPs enabled, every parent OU and account SCP must explicitly allow the action. Without an Allow in the SCP → Implicit Deny.
- •Step 3 — Evaluate Resource-Based Policies (S3 Bucket Policy, KMS Key Policy...): Within the same AWS account, if a Resource-based Policy grants an explicit
Allowdirectly to the IAM Principal (and no SCP or Explicit Deny blocks it), the request succeeds even if the Identity Policy lacks an Allow (unless a Permissions Boundary is attached). - •Step 4 — Evaluate IAM Permissions Boundaries: If a Permissions Boundary is attached to the IAM User or Role, the action must be allowed by both the Permissions Boundary and the Identity-based Policy.
- •Step 5 — Evaluate Identity-Based Policies & Session Policies: Finally, AWS inspects policies attached to the IAM User, Group, or Role. If no matching
Allowstatement exists → Default Implicit Deny.
2. Comparing SCPs, Permissions Boundaries, and Identity Policies
| Policy Type | Attachment Target | Grants Permissions by Itself? | Classic AWS Exam Use Case |
|---|---|---|---|
| Service Control Policy (SCP) | AWS Organization Root, OU, or Member Account | NO (Sets the maximum permission ceiling for the entire Member Account, including its Root user) | Prevent any account in the company from launching resources outside ap-southeast-1 or disabling CloudTrail. |
| IAM Permissions Boundary | Specific IAM User or IAM Role | NO (Sets the maximum permission ceiling for that individual IAM Principal) | Allow developers to create new IAM Roles for Lambda while preventing privilege escalation to AdministratorAccess. |
| Identity-based Policy | IAM User, IAM Group, or IAM Role | YES (Directly grants actionable permissions) | Grant read/write access to S3 buckets, launch EC2 instances, or query DynamoDB tables. |
3. The Classic Cross-Account Access Trap
Scenario Prompt:
Account A contains an IAM Role named AnalyticsRole. Account B owns an Amazon S3 bucket named finance-data-bucket. The administrator in Account B attaches an S3 Bucket Policy granting arn:aws:iam::AccountA:role/AnalyticsRole permission to perform s3:GetObject. However, when the application in Account A runs, it still receives an Access Denied error. Why?
✕ Common Distractor Trap
Because the two AWS accounts reside in different VPCs and require a VPC Peering connection before calling the S3 API.
✓ Recommended Architecture
For Cross-Account access, BOTH sides (the Identity-based Policy on AnalyticsRole in Account A AND the S3 Bucket Policy in Account B) must explicitly include an Allow statement.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyStopCloudTrail",
"Effect": "Deny",
"Action": [
"cloudtrail:StopLogging",
"cloudtrail:DeleteTrail"
],
"Resource": "*"
},
{
"Sid": "RequireMicroOrLargeInstanceType",
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringNotEquals": {
"ec2:InstanceType": ["t3.micro", "m6i.large"]
}
}
}
]
}✓ AWS EXAM TIP: WHEN TO USE STS ASSUMEROLE INSTEAD OF A RESOURCE POLICY

COMPANION MOBILE APP
LearnAWS by CertWorm
Turn these architecture blueprints into daily muscle memory with AI Study Coach roadmaps, timed 65-question mock exams, and choice-level rationales on iOS & Android.