Cert Notes/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
SCS-C03 · SpecialtySecurity - Specialty
  • Week 1
    • 1.Shared Responsibility Model and SCS-C03's 6 Domains: The Big Picture for Security Engineers
    • 2.IAM Core: Users, Groups, Roles, Policies, and Policy Evaluation Flow
    • 3.Advanced IAM Policies: Identity vs Resource, Condition Keys, and Least-Privilege Design
    • 4.STS and Temporary Credentials: AssumeRole, Federation, Role Chaining, Confused Deputy Prevention
    • 5.Week 1 Synthesis: Integrating IAM and Credentials Through Scenarios
  • Week 2
    • 1.Master IAM Policy Evaluation Logic: Explicit Deny Beats Everything
    • 2.Permission Boundary and Delegation: The Safe Way to Grant Permissions to Developers
    • 3.AWS Organizations and SCP: Account-Level Guardrail Design
    • 4.Day 4
    • 5.Day 5
  • Week 3
    • 1.Enable VPC Flow Logs (detailed in Day 3)
    • 2.Scenario: Web server (443) receiving Internet connection
    • 3.1. CloudWatch Logs — suits real-time alarms (Metric Filter)
    • 4.Gateway Endpoint (S3) — add route to table, free
    • 5.Day 5
  • Week 4
    • 1.Day 1
    • 2.AWS Shield (Standard/Advanced) and DDoS Protection: Layered Defense, CloudFront/Route 53 Integration
    • 3.AWS Network Firewall and DNS Firewall: Stateful Inspection, Domain Filtering, Centralized Inspection VPC
    • 4.Edge Security Integration: CloudFront (OAC, Signed URLs), ACM Certificates, Perimeter Security Architecture
    • 5.Week 4 Synthesis: Integrated Review of Edge and Perimeter Defense Scenarios
  • Week 5
    • 1.AWS KMS Fundamentals: CMK Types, Key Policy vs IAM, Symmetric/Asymmetric Keys
    • 2.Envelope Encryption and Data Keys: GenerateDataKey, Encryption Context
    • 3.Key Policies, Grants, and Cross-Account Sharing: ViaService Condition and Key Governance
    • 4.Encryption at Rest/in Transit: TLS, Service-Specific Encryption, Key Rotation
    • 5.Week 5 Synthesis: Integrated Review of Encryption and Key Management Scenarios
  • Week 6
    • 1.Secrets Manager: Automatic Rotation (Lambda), Parameter Store Comparison, Cross-Account Secrets
    • 2.S3 Data Protection: SSE-S3/SSE-KMS/DSSE, Bucket Keys, Object Lock, Versioning, Block Public Access
    • 3.S3 Access Control Deep Dive: Bucket Policies, ACLs, Access Points, Encryption Enforcement, Exfiltration Prevention
    • 4.ACM and Macie: Certificate Lifecycle and Integration, Macie Sensitive Data (PII) Detection and Classification
    • 5.Week 6 Integration: Secrets, Storage, and Sensitive Data Scenario Review
  • Week 7
    • 1.CloudTrail: Management/Data Events, Organization Trail, Log File Integrity Validation, CloudTrail Lake
    • 2.AWS Config: Configuration Items and Records, Rules (Managed/Custom Lambda), Conformance Pack, Auto-Remediation
    • 3.VPC Flow Logs and Network Logging: Detecting Breaches/Misconfig via Traffic, Route 53 Resolver Query Logs
    • 4.Log Integrity, Retention, and Centralization: S3 Object Lock, Cross-Account Log Aggregation, KMS Encryption of Logs
    • 5.Week 7 Integration: Audit Trail Scenario Review
  • Week 8
    • 1.CloudWatch: Log Groups, Metric Filters, Alarms, Anomaly Detection, Security Event Notifications
    • 2.Security Hub: Security Standards (CIS/FSBP), Consolidated Score, Finding Aggregation and Normalization (ASFF), Automated Response
    • 3.Log Analysis: Query CloudTrail/VPC Flow with Athena, OpenSearch, CloudWatch Logs Insights
    • 4.EventBridge Security Automation: Finding Routing, Alert Pipelines, Security Data Lake Concept
    • 5.Week 8 Integration: Monitoring, Aggregation, Analysis Scenario Comprehensive Review
  • Week 9
    • 1.Amazon GuardDuty: Threat Detection Principles, Finding Types, Threat Intelligence, Multi-Account Delegated Administrator
    • 2.Amazon Detective: Finding Investigation and Root Cause, Behavior Graph, GuardDuty Integration
    • 3.Amazon Inspector: EC2/ECR/Lambda Vulnerability Scanning, CVE, Automated Assessment
    • 4.Detection Integration: GuardDuty + Security Hub + Detective + Inspector One Picture, Multi-Account Detection Baseline
    • 5.Week 9 Synthesis: Integrated Review of Threat Detection Scenarios
  • Week 10
    • 1.Automated Response Pipeline: EventBridge + SSM Automation + Lambda for Auto-Remediation of Findings
    • 2.Incident Response for Compromised EC2: Isolation, Snapshots, Forensics, Credential Revocation
    • 3.Credential Exposure Response: Access Key Exposure, Root Compromise, IAM Neutralization and Rotation Playbook
    • 4.Incident Response Framework: NIST Phases, Runbooks, Automation vs Human Judgment Boundary
    • 5.Week 10 Synthesis: Integrated Incident Response Scenario Review
  • Week 11
    • 1.AWS Organizations Security Governance: SCP Design, Delegated Administrators, Central Security Account Model
    • 2.Control Tower and Landing Zone: Guardrails (Preventive/Detective), Account Factory, Compliance Baseline
    • 3.Audit Manager and Compliance: Automated Evidence Collection, Frameworks (CIS/PCI), Config Integration
    • 4.Multi-Account Security Operations: Firewall Manager, Central Policy Distribution, Cost/Tag Governance, Security Baseline Automation
    • 5.Week 11 Comprehensive Review: Integrated Governance Scenarios
  • Week 12
    • 1.Integrated Review Domains 1 & 2: Threat Detection and Incident Response ↔ Security Logging and Monitoring
    • 2.Integrated Review Domains 3 & 4: Infrastructure Security ↔ Identity and Access Management
    • 3.Integrated Review Domains 5 & 6: Data Protection ↔ Management and Governance
    • 4.Full Practice Exam Pace: Six-Domain Synthesis Scenario Review
    • 5.D-Day Final: Exam Strategy, Keyword Translation, Trap Summary
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
← SCS-C03/Week 1/Day 4
SCS-C03· AssociateWeek 1 · Day 4~22 min read

Day 4 - STS and Temporary Credentials: AssumeRole, Federation, Role Chaining, Confused Deputy Prevention

For the past four days, we've repeated "use Role and its temporary credentials, not IAM User's long-term access key." Today we dive into how that Role is "assumed" — the mechanism of STS (Security Token Service) that issues credentials, how external identities (federation) exchange for AWS credentials, and why cross-account delegation demands blocking the Confused Deputy attack. The deepest differentiation in SCS-C03's Domain 4 lies here — AssumeRole trust relationships, role chaining constraints, and mandatory Confused Deputy prevention.

Core one-liner first: STS issues expiring temporary credentials (AccessKeyId + SecretAccessKey + SessionToken), and "who can assume this role" is decided by the role's trust policy.

What STS Issues: Three Types of Temporary Credentials

Long-term IAM User credentials are 2 keys (AccessKeyId, SecretAccessKey), but STS temporary credentials are 3.

ComponentRole
AccessKeyIdIdentifier
SecretAccessKeySigning key
SessionTokenTemporary session proof (doesn't exist in long-term keys)

These credentials have an expiration time. AssumeRole defaults to 1 hour, maximum 12 hours (within role's MaxSessionDuration). After expiration, you must get new ones. Even if exposed, damage is time-limited — the fundamental reason temporary credentials are safer than long-term keys.

Key STS APIs:

APIPurpose
AssumeRoleAssume an IAM Role in same/different account (most common)
AssumeRoleWithSAMLSAML 2.0 IdP federation (e.g., AD FS, Okta)
AssumeRoleWithWebIdentityOIDC federation (e.g., Cognito, Google, GitHub Actions)
GetSessionTokenMFA-applied temporary credentials (IAM User)
GetFederationTokenLegacy federation

💡 Related Theory: EC2 instance profiles, Lambda execution roles, ECS task roles all internally use STS AssumeRole. For EC2, the instance metadata service (IMDS) auto-issues and refreshes temporary credentials. No need to embed keys in code. IMDSv2 (token-based) must be enforced to block SSRF attacks that steal metadata — a classic exam topic and was central to the Capital One incident.

AssumeRole: Two Axes of Trust and Permission Policies

A Role holds two policies. This distinction is the most confusing in IAM.

  • Trust policy: "Who can assume this role" (sts:AssumeRole permissible targets). Contains Principal = resource-based policy.
  • Permission policy: "What this role can do once assumed." Identity-based policy.
// Trust policy: principals in account 111122223333 can assume this role
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::111122223333:root"},
    "Action": "sts:AssumeRole",
    "Condition": {
      "StringEquals": {"sts:ExternalId": "unique-secret-2026"},
      "Bool": {"aws:MultiFactorAuthPresent": "true"}
    }
  }]
}

Cross-account AssumeRole succeeds only when both align:

  1. Target role's trust policy permits the calling account/principal as Principal
  2. Calling side's identity policy has sts:AssumeRole Allow (target role ARN specified)

⚠️ Trap: Using "arn:aws:iam::111122223333:root" in trust policy Principal means "entire account 111122223333 can assume this role" — not just the root user. However, practically, only principals in that account holding sts:AssumeRole permission can assume it (condition 2). The intuition "root Principal is risky" is half right — account delegation is normal, but internal permission control is that account's responsibility.

Federation: Converting External Identity to AWS Credentials

Without creating IAM Users, accessing AWS via corporate directory (AD) or social/OIDC identity is federation.

SAML 2.0 Federation (Enterprise Workforce)

[ SAML Federation Flow ]

  User → Enterprise IdP(AD FS/Okta) login
       → IdP issues SAML assertion(role ARN included)
       → AWS STS AssumeRoleWithSAML
       → Temporary credentials issued
       → Access AWS resources

Today's recommended approach: IAM Identity Center (formerly AWS SSO). Define permission sets in multi-account environments, integrate with external IdPs (Okta, Entra ID, etc.), and users get temporary credentials across multiple accounts and roles via single login. Eliminates the anti-pattern of creating IAM Users per account.

OIDC / Web Identity Federation (Apps·CI/CD)

Mobile apps (Cognito), GitHub Actions, Kubernetes (EKS IRSA) use OIDC for AssumeRoleWithWebIdentity. Particularly GitHub Actions OIDC matters in both exam and practice — instead of embedding long-lived access key in GitHub secrets, GitHub's OIDC token assumes a role, eliminating key exposure risk.

🔍 Deep Dive: GitHub Actions OIDC trust policy sets token.actions.githubusercontent.com as OIDC provider, and Condition limits with token.actions.githubusercontent.com:sub to specific repo·branch only. Loose conditions like repo:org/* let any org repo assume the role — risky. Tighten to repo:org/repo:ref:refs/heads/main. EKS IRSA uses the same OIDC principle, mapping pods to roles.

Role Chaining (Role Chaining) and Constraints

Assuming another role while already in one role is role chaining. Account A → assume role X → assume role Y with role X credentials.

Two key constraints in exams:

  1. Chained session max time is fixed at 1 hour. Even if role X's MaxSessionDuration is 12 hours, a chained session tops at 1 hour.
  2. Chained sessions can't invoke certain calls like GetSessionToken.

💡 Related Theory: Role chaining obscures permission tracking and is generally avoided. Prefer session policy or direct AssumeRole. However, "hub account role → spoke account access" pattern in cross-account is legitimate chaining. Traceability is supplemented by CloudTrail's assumedRole session name (set sts:RoleSessionName meaningfully).

Confused Deputy Prevention: ExternalId and aws:SourceArn

Today's security core. Confused Deputy (confused intermediary) is when an authorized principal (intermediary) is tricked into using permissions on behalf of a third party.

Scenario: Third-party SaaS Cross-Account Access

Say monitoring SaaS (e.g., Datadog) AssumeRoles into your account. SaaS uses the same SaaS account for all customers. If trust policy only checks "SaaS account, allow," a malicious user could impersonate your account ID to SaaS and gain your resources.

Solution: ExternalId — SaaS issues you a unique secret that you embed in the trust policy's Condition.

{
  "Effect": "Allow",
  "Principal": {"AWS": "arn:aws:iam::SAAS-ACCOUNT-ID:root"},
  "Action": "sts:AssumeRole",
  "Condition": {
    "StringEquals": {"sts:ExternalId": "your-unique-external-id-xyz"}
  }
}

SaaS passes this ExternalId when assuming your role; customers' ExternalIds won't work. Isolation is guaranteed.

When AWS Service is the Intermediary: aws:SourceArn / aws:SourceAccount

When a service principal (e.g., CloudWatch, S3, SNS) uses your role or resource, the same attack is possible. Use aws:SourceArn (or aws:SourceAccount) to enforce "only this specific resource triggers this."

{
  "Effect": "Allow",
  "Principal": {"Service": "sns.amazonaws.com"},
  "Action": "sts:AssumeRole",
  "Condition": {
    "StringEquals": {"aws:SourceAccount": "111122223333"},
    "ArnLike": {"aws:SourceArn": "arn:aws:sns:us-east-1:111122223333:my-topic"}
  }
}

🎯 Scenario: "Third-party backup vendor needs cross-account S3 access." Answer pattern: ① never give vendor IAM User access keys (absolute ban) ② create IAM Role + trust policy with vendor account + ExternalId ③ permission policy restricted to needed buckets/Actions (least privilege). Without ExternalId, another vendor customer using the same vendor could access our resources — Confused Deputy hole. This pattern applies uniformly to Datadog, New Relic, PagerDuty, all third-party integrations.

⚠️ Trap: ExternalId isn't a "password" — even if guessable, it blocks the attack. The key is customer doesn't set ExternalId; vendor issues it. Customer-set IDs could collide with others or be predictable, breaking isolation. Trap answer: "Customer freely sets ExternalId" — wrong.

AssumeRole as CLI

# Assume role — returns 3 credential types
aws sts assume-role \
  --role-arn arn:aws:iam::444455556666:role/CrossAccountReadRole \
  --role-session-name security-audit-2026 \
  --external-id your-unique-external-id-xyz \
  --duration-seconds 3600
 
# Use returned credentials for subsequent calls (after env vars set)
export AWS_ACCESS_KEY_ID=ASIA...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...   # SessionToken mandatory for temp credentials
aws sts get-caller-identity    # Verify who you are now

📚 Case Study: The 2019 Capital One incident's essence: ① WAF (SSRF defense insufficient) ② IMDSv1 let EC2 temp credentials be stolen ③ those credentials accessed S3. Temporary credentials are safe, but the path to steal them (SSRF → IMDS) being open neutralizes that. Hence IMDSv2 enforcement + least-privilege instance role + WAF bundle in exam. Temporary credentials are "exposure damage is time-limited," but blocking exposure paths is separate.

Summary — Temporary Credentials Are Security Default

Three essentials today. First, STS issues expiring temporary credentials (with SessionToken), and EC2/Lambda/ECS/federation all run on this — replace long-key code/CI anti-patterns with OIDC and instance roles. Second, AssumeRole is two axes: trust policy (who) and permission policy (what) — cross-account needs both sides allowing. Third, cross-account delegation must block Confused Deputy via ExternalId (third-party) or aws:SourceArn (AWS service).

Tomorrow closes Week 1 with integrated scenarios. "Why is access denied despite having permissions," "safely delegate to third parties," "convert long-term keys to temporary credentials" — real-world problems synthesizing everything Week 1 taught. We cement this week's IAM thinking framework.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

What is the most fundamental reason STS temporary credentials are more secure than long-lived IAM user access keys?

Question 2

A third-party monitoring SaaS uses the same SaaS account to AssumeRole into many customers' AWS accounts. What is the key mechanism that stops one customer from assuming another customer's role through the SaaS?

Question 3

Which statement about role chaining (assuming another role while already in an assumed role) is correct?

Question 4

When configuring GitHub Actions to assume an AWS role without long-lived access keys, which trust policy setting matters most for security?

Question 5

Which control should you apply most directly to prevent an incident where temporary credentials granted to an EC2 instance are stolen through an SSRF attack?

PreviousAdvanced IAM Policies: Identity vs Resource, Condition Keys, and Least-Privilege DesignWeek 1 · Day 3Next Week 1 Synthesis: Integrating IAM and Credentials Through ScenariosWeek 1 · Day 5

On this page

  • What STS Issues: Three Types of Temporary Credentials
  • AssumeRole: Two Axes of Trust and Permission Policies
  • Federation: Converting External Identity to AWS Credentials
  • SAML 2.0 Federation (Enterprise Workforce)
  • OIDC / Web Identity Federation (Apps·CI/CD)
  • Role Chaining (Role Chaining) and Constraints
  • Confused Deputy Prevention: ExternalId and aws:SourceArn
  • Scenario: Third-party SaaS Cross-Account Access
  • When AWS Service is the Intermediary: aws:SourceArn / aws:SourceAccount
  • AssumeRole as CLI
  • Summary — Temporary Credentials Are Security Default
  • Practice Questions