This lesson combines 3 topics: Introduction to the AWS SAP-C02 exam, AWS Global Infrastructure, Advanced IAM.
Learning Objectives
- Understand the structure and requirements of the SAP-C02 exam
- Know the main domains and their scoring weights
- Know how to approach exam questions effectively
- Understand the structure of AWS global infrastructure
- Distinguish Regions, Availability Zones, and Edge Locations
- Know how to choose the right Region for a workload
- Understand IAM Policies in depth and how they are evaluated
- Master IAM Roles and cross-account access
- Understand Permission Boundaries and SCPs
Part 1: Introduction to the AWS SAP-C02 Exam
1. SAP-C02 Exam Overview
Who the exam is for
The exam is intended for people who already have:
- The AWS Solutions Architect Associate certification (recommended)
- At least 2 years of hands-on experience with AWS
- Experience designing distributed systems on AWS
Exam structure
- Duration: 180 minutes (3 hours)
- Number of questions: 75 (65 scored, 10 unscored)
- Question types: Multiple choice and Multiple response
- Passing score: 750/1000
- Exam fee: $300 USD
2. The Four Main Domains
Domain 1: Design Solutions for Organizational Complexity (26%)
- Multi-account strategy
- AWS Organizations and SCPs
- Cross-account access
- Complex networking
Domain 2: Design for New Solutions (29%)
- Business continuity
- Architectures that meet performance requirements
- Security and compliance
- Cost optimization
Domain 3: Continuous Improvement for Existing Solutions (25%)
- Operational excellence
- Reliability improvements
- Performance tuning
- Cost optimization
Domain 4: Accelerate Workload Migration and Modernization (20%)
- Migration strategies (7Rs)
- Hybrid architectures
- Modernization patterns
- Data migration
3. Exam Strategy
Time management
- About 2.4 minutes per question on average
- Flag hard questions and come back later
- Reserve the last 15-20 minutes for review
How to read a question
- Read the final requirement first - What are they asking?
- Identify the key keywords:
- "Cost-effective" → Cost optimization
- "Least operational overhead" → Managed services
- "Most secure" → Security best practices
- "Minimum latency" → High performance
- Eliminate wrong answers - There are usually 1-2 obviously wrong answers
Common keywords
| Keyword | Meaning |
|---|---|
| MOST cost-effective | Pick the cheapest solution that meets the requirements |
| LEAST operational overhead | Prefer managed services |
| MOST secure | Apply security best practices |
| MINIMUM changes | The fewest changes from the current state |
| Disaster recovery | Focus on RTO/RPO |
4. Comparison with SAA (Associate)
| Aspect | SAA (Associate) | SAP (Professional) |
|---|---|---|
| Depth | Foundational knowledge | In-depth knowledge |
| Scope | Single account | Multi-account, hybrid |
| Questions | Simple scenarios | Complex, long scenarios |
| Focus | "What" and "How" | "Why" and "Trade-offs" |
Part 2: AWS Global Infrastructure
1. AWS Global Infrastructure Structure
2. Regions
Definition
- A Region is a separate geographic area
- Each Region is fully independent of other Regions
- Data is NOT automatically replicated between Regions
Naming
- Format:
{area}-{sub-area}-{number} - Example:
ap-southeast-1(Singapore)
Popular Regions in Asia
| Region Code | Name | Number of AZs |
|---|---|---|
| ap-southeast-1 | Singapore | 3 |
| ap-southeast-2 | Sydney | 3 |
| ap-northeast-1 | Tokyo | 4 |
| ap-northeast-2 | Seoul | 4 |
| ap-south-1 | Mumbai | 3 |
3. Availability Zones (AZs)
Characteristics
- Each AZ is one or more data centers
- AZs are tens of kilometers apart (low latency connectivity)
- Each has its own independent power, cooling, and networking
- Connected to each other via a high-bandwidth, low-latency network
Why multiple AZs?
Best Practices
- Deploy workloads across at least 2 AZs
- Use an Auto Scaling Group with multi-AZ
- Use RDS Multi-AZ for production databases
4. Edge Locations & Regional Edge Caches
Edge Locations
- Used by CloudFront and Route 53
- Cache content as close to users as possible
- Reduce latency for end users
Regional Edge Caches
- Sit between the Origin and Edge Locations
- Cache less popular content
- Reduce load on the Origin server
Services that use the Edge
| Service | Purpose |
|---|---|
| CloudFront | CDN, cache static/dynamic content |
| Route 53 | DNS, health checks |
| AWS WAF | Web Application Firewall |
| AWS Shield | DDoS protection |
| Lambda@Edge | Code execution at edge |
5. Local Zones
When to use them?
- You need ultra-low latency (<10ms)
- Real-time applications (gaming, video streaming)
- There is no nearby Region yet
Characteristics
- An extension of a Region
- Supports: EC2, EBS, VPC, ELB, etc.
- Not every service is available
6. Wavelength Zones
Definition
- AWS infrastructure inside carriers' 5G networks
- Ultra-low latency for mobile applications
Use cases
- AR/VR applications
- Real-time gaming
- Connected vehicles
- IoT with low-latency requirements
7. How to Choose a Region
Factors to consider
Real-world example
Scenario: A Vietnamese company needs to deploy an application for users in Southeast Asia
Analysis:
- Compliance: No special data residency requirements
- Latency: Users are in SEA →
ap-southeast-1(Singapore) - Services: Singapore has the full set of services
- Pricing: Singapore is reasonably priced
Conclusion: Choose ap-southeast-1
Part 3: Advanced IAM
1. IAM Policy Evaluation Logic
Evaluation order
1. Explicit DENY → If present → DENY (stop)
↓
2. RCPs (Org) → If not Allowed → DENY (resource-side boundary, 11/2024)
↓
2b. SCPs (Org) → If not Allowed → DENY (principal-side boundary)
↓
3. Resource Policy → If Allowed → ALLOW (for cross-account)
↓
4. Permission Boundary → If not Allowed → DENY
↓
5. Session Policy → If not Allowed → DENY
↓
6. Identity Policy → If Allowed → ALLOW
↓
7. Implicit DENY → DENY by default
Key principles
- Explicit Deny always wins
- Deny by default - no Allow = Deny
- Cross-account: Requires an Allow from BOTH sides
- SCP vs RCP: An SCP limits the maximum permissions of principals in a member account; a Resource Control Policy (RCP) limits the maximum permissions that resources in a member account can grant to any principal (including principals outside the org). Neither grants permissions; both are only boundaries. Effective permissions = the intersection SCP ∩ RCP ∩ identity/resource policy. The IAM docs evaluate RCPs before SCPs, but because it is an intersection, the order does not change the result. Details in Week 2 Day 1 (Part 1).
2. Types of IAM Policies
Identity-based Policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Resource-based Policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Comparison
| Type | Attached to | Principal field |
|---|---|---|
| Identity-based | User, Group, Role | None |
| Resource-based | Resource (S3, SQS, etc.) | Required |
3. IAM Roles
Role structure
Trust Policy Example
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Common role types
| Type | Principal | Use case |
|---|---|---|
| Service Role | AWS Service | EC2 instance profile |
| Cross-account Role | AWS Account | Access from another account |
| Identity Provider Role | Federated | SSO, SAML, OIDC |
4. Cross-Account Access
Option 1: Resource-based Policy
Option 2: IAM Role (Recommended)
Comparing the two options
| Aspect | Resource Policy | IAM Role |
|---|---|---|
| Audit | Harder | Easier (CloudTrail) |
| Flexibility | Only 1 resource | Many resources |
| Best Practice | One-off access | Regular access |
5. Permission Boundaries
Definition
- Limits the maximum permissions an identity-based policy can grant
- Does not grant permissions, only limits them
Example
Use case
- Let developers create their own roles while limiting permissions
- Delegated administration
6. Service Control Policies (SCPs)
Characteristics
- Applied at the AWS Organizations level
- Affect all principals in the account
- Do NOT affect the management account
SCP Strategies
Strategy 1: Deny List (Recommended)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"organizations:LeaveOrganization"
],
"Resource": "*"
}
]
}
Strategy 2: Allow List
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:*",
"s3:*"
],
"Resource": "*"
}
]
}
7. IAM Best Practices at the Professional level
- Least Privilege: Grant only the minimum permissions needed
- Use Roles: Avoid long-term credentials
- Enable MFA: Especially for privileged actions
- Rotate Credentials: Rotate access keys periodically
- Use Conditions: Restrict by IP, MFA, time
- Audit Regularly: Use IAM Access Analyzer
8. Confused Deputy Problem & ExternalId
The problem
When you let a third party (SaaS monitoring, partner, MSP...) assume a role in your account, that third party becomes a "deputy": an entity authorized to act on behalf of many customers. A confused deputy happens when an attacker tricks the deputy into using its permissions against an account that does NOT belong to the attacker:
- Role ARNs have a guessable format (
arn:aws:iam::<account-id>:role/<name>), and account IDs are not secrets. - The attacker signs up for the same SaaS and submits the victim's Role ARN → the SaaS (deputy) unknowingly assumes the victim's role and returns the results to the attacker.
Solution: sts:ExternalId
The third party issues EACH customer a unique ExternalId (unique per-customer, generated by the provider; the customer does not choose it). The customer's trust policy only allows AssumeRole when the ExternalId matches:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::999988887777:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "cust-a1b2c3-unique"
}
}
}
]
}
When the provider calls AssumeRole, it passes the ExternalId tied to the customer making the request. The attacker submits the victim's Role ARN, but the ExternalId in the request belongs to the attacker → the condition does not match → AccessDenied.
Professional-level notes:
- ExternalId is not a secret (it does not replace MFA/credentials). It is only a "scoping mechanism" against confused deputy: it prevents misuse, not credential leaks.
- The provider must be the party that generates and pins the per-customer ExternalId; if customers can type any ExternalId they like, an attacker can enter a matching one → the protection is void.
- IAM Access Analyzer generates an external access finding for every role whose trust policy allows an account outside the zone of trust. It has no dedicated finding for "missing ExternalId". Approach: review each finding and use an archive rule for legitimate third-party trust roles that already have
sts:ExternalId; to enforce ExternalId, check trust policies through periodic reviews or a custom AWS Config rule you write yourself.
Service-to-service variant: aws:SourceArn / aws:SourceAccount
Confused deputy also happens between AWS services: for example, an attacker's SNS topic or S3 bucket calls your KMS key / Lambda / SQS, because the service principal (sns.amazonaws.com, s3.amazonaws.com) is SHARED by all accounts. Block it with conditions in the resource policy:
{
"Effect": "Allow",
"Principal": { "Service": "sns.amazonaws.com" },
"Action": ["kms:GenerateDataKey*", "kms:Decrypt"],
"Resource": "*",
"Condition": {
"ArnLike": {
"aws:SourceArn": "arn:aws:sns:us-east-1:111122223333:my-topic"
},
"StringEquals": {
"aws:SourceAccount": "111122223333"
}
}
}
| Scenario | Confused deputy protection |
|---|---|
| A third party (human/app) assumes a role cross-account | sts:ExternalId in the trust policy |
| An AWS service calls a resource on your behalf (SNS→KMS, S3→SQS...) | aws:SourceArn + aws:SourceAccount in the resource policy |
Exam keywords: "third-party access", "SaaS provider needs access", "prevent confused deputy" → think ExternalId right away. "Service acting on your behalf" →
aws:SourceArn/aws:SourceAccount.
9. Custom Identity Broker
When do you need one?
When the internal corporate IdP does NOT support SAML 2.0 or OIDC (legacy LDAP, a home-grown auth system...), you cannot use SAML federation or IAM Identity Center directly. You must write your own Identity Broker: an intermediary app that authenticates the user against the IdP itself, then calls STS to get temporary credentials.
Flow
- The user authenticates with the broker; the broker verifies against the corporate IdP.
- The broker decides on its own which IAM role/policy the user maps to (this is the biggest difference from SAML: there is no automatic assertion attribute mapping).
- The broker calls STS:
AssumeRole(recommended): credentials last 15 minutes–12 hours, permissions = role policy (∩ session policy if passed).GetFederationToken: called with the long-term credentials of an IAM user (the broker runs on-prem), up to 36 hours; permissions = the IAM user's identity policy ∩ the passed session policy. You MUST pass a session policy, otherwise the token has almost no permissions.
- The broker returns temporary credentials to the user (API/CLI), or builds a console sign-in URL via the federation endpoint (
https://signin.aws.amazon.com/federationwith actiongetSigninToken→login).
Trade-offs (Professional level)
- You are responsible for EVERYTHING yourself: verifying identity, mapping user→role, vaulting the broker's credentials, auditing. The broker becomes a high-value target; it is itself a deputy that needs protecting.
- Multi-account: the broker can assume roles into each member account (hub-spoke from an identity account), but managing the mapping yourself at large scale is very labor-intensive → this is why AWS recommends migrating the IdP to SAML/OIDC or IAM Identity Center whenever possible.
Quick comparison: when to use what?
| Aspect | SAML Federation / Identity Center | Custom Identity Broker | Cognito |
|---|---|---|---|
| IdP requirement | IdP supports SAML 2.0/OIDC | IdP supports NO standard | Web/mobile app users (not workforce) |
| Who maps user → permissions | IdP assertion attributes → role automatically | Broker must code the mapping logic ITSELF | Identity Pool role mapping (rules/token claims) |
| Who calls STS | AWS handles it (AssumeRoleWithSAML/WithWebIdentity) | Broker calls AssumeRole/GetFederationToken itself | Cognito Identity Pool calls it for you |
| Operational overhead | Low | High (build + maintain yourself) | Low |
| Typical use case | Workforce SSO into Console/CLI | Legacy IdP, special auth requirements | Customer-facing app needing scoped AWS creds |
Exam keywords: "identity provider does NOT support SAML" → Custom Identity Broker + STS. "Mobile/web app users" → Cognito. "SAML 2.0-compliant IdP" → SAML federation / IAM Identity Center.
Review Questions
-
How many scored questions does the SAP-C02 exam have?
Show answer
65 scored questions (out of 75 total; 10 are unscored for AWS to trial). 180 minutes = about ~2.4 minutes per question on average. Compared with SAA-C03: 50 scored out of 65 total. SAP-C02 is harder, with longer scenarios (~10-15 lines per question).
-
Which domain has the highest weight?
Show answer
Domain 2: Design New Solutions at 29%. The other domains: Domain 1 (Organizational Complexity) 26%, Domain 3 (Continuous Improvement) 25%, Domain 4 (Migration & Modernization) 20%. Domains 2 + 1 make up 55%, so focus your study on multi-account patterns, advanced compute, storage, database, and HA patterns.
-
When you see the keyword "least operational overhead", which kind of service should you prefer?
Show answer
Managed/serverless services: Lambda, Fargate, Aurora Serverless, DynamoDB, SQS, SNS, RDS Multi-AZ. "Least operational overhead" = AWS manages patching, scaling, HA. Avoid solutions that require managing EC2, self-managed databases, or custom scripts. At the SAP level: especially prefer fully-managed cross-account services such as Organizations, Control Tower, IAM Identity Center.
-
What is the passing score for the exam?
Show answer
750/1000 (scaled scoring). Higher than SAA-C03 (720/1000). The exam fee is $300 USD. Valid for 3 years. SAP-C02 is a Professional-level certification: it requires a deep understanding of trade-offs, multi-service architectures, and enterprise patterns, not just knowing service names.
-
What is the difference between a Region and an Availability Zone?
Show answer
A Region is an independent geographic area with 3-6 AZs (the current AWS standard: every new Region has at least 3 AZs) (for example ap-southeast-1 Singapore). An AZ is 1+ data centers within a Region, with its own independent power/cooling/network, connected to other AZs via low-latency private fiber (< 10ms). Regions are fully isolated for compliance and DR. AZs are isolated within a Region for HA: an AZ failure does not affect other AZs.
-
Why should you deploy applications across multiple AZs?
Show answer
Multi-AZ ensures High Availability when an AZ fails (hardware, power, flooding): ALB + ASG automatically redirect traffic to healthy AZs, RDS Multi-AZ fails over automatically in < 2 minutes, ElastiCache replicas are promoted automatically. AWS SLAs for many services require a Multi-AZ deployment: ALB/EC2 99.99%, RDS Multi-AZ (instance and cluster) 99.95%, Aurora 99.99%. Single-AZ RDS (Single-DB Instance) only has a 99.5% SLA. Single-AZ does not meet high SLAs and is not suitable for production.
-
Which services use Edge Locations?
Show answer
CloudFront (CDN, caching content at 700+ Edge Locations), Route 53 (DNS resolution at the edge to reduce latency), AWS Global Accelerator (anycast IP routing over the edge network), Shield Standard (automatic DDoS protection at the edge). There are many times more Edge Locations than Regions; they sit close to users to reduce latency when serving static/dynamic content.
-
When should you use Local Zones?
Show answer
Use Local Zones when you need single-digit millisecond latency to users in a specific metro area with no nearby Region: real-time video editing/rendering (media production), competitive online gaming (< 5ms), HFT financial trading, real-time medical imaging. Local Zones provide a subset of AWS services in large cities (LA, Chicago...) with a connection back to the parent Region.
-
What are the 4 main factors when choosing a Region?
Show answer
(1) Latency: pick the Region closest to users to reduce end-user latency. (2) Compliance/Data residency: GDPR requires EU data, PDPA requires Thailand data, some industries need data kept in-country. (3) Service availability: new services launch in some Regions first (us-east-1 is usually first); not every service is available everywhere. (4) Cost: prices differ significantly between Regions (us-east-1 is usually the cheapest).
-
When there is both an Explicit Deny and an Explicit Allow, what is the result?
Show answer
Explicit Deny always wins: the result is DENY no matter how many Allow statements there are. This is the core principle of IAM policy evaluation: Explicit Deny > Explicit Allow > Implicit Deny (default). It applies when evaluating all policies: identity-based, resource-based, SCP, RCP, Permission Boundary, session policies.
- How does cross-account access with a Role differ from a Resource Policy?
Show answer
Role: principal B assumes a role in account A → receives temporary credentials → uses those credentials to access resources in A. Requires a trust policy (who can assume) + a permission policy (what it can do). Resource Policy (for example an S3 bucket policy): grants a principal from account B direct access, with no need to assume a role. A resource policy is simpler for specific resources; use a Role when you need access to many resources or need to assume a different identity.
- Can a Permission Boundary grant additional permissions?
Show answer
No: a Permission Boundary only limits the maximum permissions (ceiling); it does not grant permissions. Effective permissions = the intersection of the Identity-based policy AND the Permission Boundary. Example: the Boundary allows S3+EC2, the Identity policy allows S3+DynamoDB → effective is only S3. Use a Boundary to let admins create roles/users without exceeding a defined scope: delegate IAM safely.
- Do SCPs affect the management account?
Show answer
No: SCPs are not applied to the management account (the root account of the AWS Organization), even an SCP attached to the root OU. SCPs only affect member accounts. Best practice: do not deploy workloads in the management account and use dedicated member accounts for workloads. Use the management account only for billing, organization management, and Control Tower setup.
- A SaaS provider needs to assume roles into the accounts of many customers. How do you prevent confused deputy?
Show answer
Use the sts:ExternalId condition in the role's trust policy: the provider generates an ExternalId that is unique per-customer and passes it in every AssumeRole call; the customer's trust policy only Allows when the ExternalId matches. The attacker knows the victim's Role ARN (ARNs are not secrets), but the ExternalId tied to the attacker's SaaS account does not match → AccessDenied. Note: ExternalId is not a secret and does not replace credentials; it only prevents permission misuse. For the service-to-service variant (SNS/S3 calling KMS...), use aws:SourceArn + aws:SourceAccount in the resource policy.
- The corporate IdP does not support SAML 2.0. How do you let employees access the AWS Console without creating IAM users?
Show answer
Build a Custom Identity Broker: the broker authenticates the user against the corporate IdP, determines the matching IAM role/policy itself, calls STS AssumeRole (or GetFederationToken) to get temporary credentials, then builds a console sign-in URL via the federation endpoint (https://signin.aws.amazon.com/federation). Unlike SAML federation, the broker must code the user → role mapping logic ITSELF (with SAML, the IdP assertion does this). If the IdP supports SAML/OIDC → always prefer SAML federation / IAM Identity Center (less operational overhead). If they are app users (web/mobile) → Cognito.
Hands-on Exercises
Part 1: Introduction to the AWS SAP-C02 Exam
- Read the official Exam Guide
- Sign up for an AWS Free Tier account (if you don't have one yet)
- Watch an exam introduction video on YouTube
Part 2: AWS Global Infrastructure
- Sign in to the AWS Console and view the list of Regions
- Try switching between Regions and observe which services are available
- Check the latency from Vietnam to each Region with CloudPing
Part 3: Advanced IAM
- Create an IAM Role for an EC2 instance with S3 read permissions
- Try cross-account access (if you have 2 accounts)
- Create a policy with conditions (IP restriction)
References
- AWS SAP-C02 Exam Guide
- AWS Skill Builder - Free Training
- AWS Certification Preparation
- Sample Questions
- AWS Global Infrastructure
- Regions and Availability Zones
- AWS Local Zones
- AWS Wavelength
- CloudFront Edge Locations
- IAM Access Analyzer — external access findings
- IAM User Guide
- IAM Policy Evaluation Logic
- IAM Roles
- Permission Boundaries
- Cross-Account Access
- IAM Best Practices
- The Confused Deputy Problem
- How to Use External ID When Granting Access to Your AWS Resources
- Enabling Custom Identity Broker Access to the AWS Console
- Requesting Temporary Security Credentials (AssumeRole vs GetFederationToken)