Study guide

5.1 CloudFront Security Headers & Origin Access Control

AWS Certified Security – Specialty SCS-C03

Track your progress as you read

Finished sections get a check mark.

1 Chapter 0: Getting Started with the SCS-C03 Exam

0.1 SCS-C03 Exam Format, Domains & Study Strategy

2 Chapter 1: Security Monitoring, Alerting & Threat Detection Services

1.1 Workload Monitoring & Health Check Strategies 1.2 Amazon GuardDuty Architecture & Finding Types 1.3 AWS Security Hub & Automated Conformance Assessment 1.4 Amazon Macie & Automated Data Classification

3 Chapter 2: Enterprise Logging Architecture & Analysis

2.1 Multi-Account CloudTrail & Organization Trails 2.2 Amazon Security Lake & OCSF Log Normalization 2.3 Network Telemetry: VPC Flow Logs & Route 53 Resolver Logs 2.4 Troubleshooting Security Telemetry & Log Ingestion 2.5 Analyzing, Normalizing & Correlating Security Logs

4 Chapter 3: Incident Readiness, Response Planning & Automated Runbooks

3.1 Incident Response Planning & Blast Radius Mitigation 3.2 Testing & Validating Incident Response Plans 3.3 Automated Incident Remediation with EventBridge & Step Functions 3.4 Systems Manager OpsCenter & Incident Manager Runbooks

5 Chapter 4: Digital Forensics, Evidence Preservation & Root Cause Analysis

4.1 Forensic Artifact Capture & Chain of Custody 4.2 Threat Containment & Network Quarantine Techniques 4.3 Correlating Events & Root Cause Analysis with Amazon Detective

6 Chapter 5: Edge Protection, WAF & DDoS Mitigation

5.1 CloudFront Security Headers & Origin Access Control 5.2 AWS WAF Architecture & Advanced Rule Sets 5.3 AWS Shield Advanced & DDoS Defense Architectures 5.4 Edge Integrations: Managed Rule Groups, OCSF Ingestion, IoT Policies & CORS

7 Chapter 6: Compute Workload Hardening, Vulnerability Management & GenAI Security

6.1 Golden AMIs & Container Image Hardening Pipelines 6.2 Amazon Inspector Vulnerability Management & Patch Automation 6.3 Generative AI Security: Amazon Bedrock Guardrails & Model Protection 6.4 Instance Profiles, Service Roles & Execution Roles for Compute 6.5 Secure Administrative Access: Session Manager & EC2 Instance Connect

8 Chapter 7: Network Security, Segmentation, Private Connectivity & Encryption in Transit

7.1 Layered Traffic Filtering: SGs, NACLs & AWS Network Firewall 7.2 Hybrid Connectivity Security: VPN, Direct Connect & MACsec 7.3 Zero-Trust Access & Network Access Analysis 7.4 Enforcing Encryption in Transit: ELB Security Policies, TLS & HTTPS-Only Access 7.5 Private Access: VPC Endpoints, PrivateLink, Client VPN & Verified Access 7.6 Inter-Resource Encryption in Transit: Nitro, EMR, EKS & SageMaker AI

9 Chapter 8: Enterprise Authentication, Federation & Directory Services

8.1 AWS IAM Identity Center & Enterprise IdP Integration 8.2 Amazon Cognito User Pools & Identity Pools 8.3 AWS Security Token Service (STS) & Temporary Credential Workflows 8.4 Troubleshooting Identity & Authentication Failures

10 Chapter 9: Advanced Authorization Architecture & Policy Evaluation

9.1 Complete AWS Policy Evaluation Logic & Decision Flow 9.2 Permission Boundaries & Safe Admin Delegation 9.3 Attribute-Based Access Control (ABAC) with IAM Tags

11 Chapter 10: Least Privilege, Policy Validation & External Access Auditing

10.1 IAM Roles Anywhere & Amazon Verified Permissions 10.2 Auditing External & Unused Access with IAM Access Analyzer 10.3 Analyzing Authorization Failures & Policy Simulation

12 Chapter 11: Cryptographic Services: KMS Architecture & Key Governance

11.1 AWS KMS Architecture, Key Policies & Key Types 11.2 KMS Grants, Encryption Context & Multi-Region Keys 11.3 Imported Key Material (BYOK) & CloudHSM Key Stores

13 Chapter 12: Secrets Management, Sensitive Data Masking & PKI

12.1 AWS Secrets Manager & Systems Manager Parameter Store 12.2 Sensitive Data Masking in Telemetry & Messaging 12.3 AWS Certificate Manager (ACM) & Private CA Architecture

14 Chapter 13: Storage Encryption, Integrity, Lifecycle & Backup Protection

13.1 S3 Encryption Modes & S3 Bucket Keys 13.2 Data Integrity Protection: Object Lock, Vault Lock & Code Signing 13.3 Secure Data Lifecycle, Cross-Account Replication & Backup Vault Lock 13.4 Lifecycle, Backup & Secure Replication Beyond S3: EFS, FSx, DLM, DataSync & Air-Gapped Vaults

15 Chapter 14: Multi-Account Architecture, Organizations & Control Tower Governance

14.1 AWS Organizations Structure, Hierarchy & Resource Control 14.2 AWS Control Tower Landing Zone & Guardrail Framework 14.3 Delegated Administrator Architecture & Root User Governance 14.4 Centralized Resource Sharing with RAM & Service Catalog

16 Chapter 15: Compliance Automation, Infrastructure as Code Security & Auditing

15.1 Infrastructure as Code Security & Multi-Account Deployment 15.2 AWS Config, Conformance Packs & Automated Remediation 15.3 Audit Evidence Collection & Well-Architected Security Reviews

5.1 CloudFront Security Headers & Origin Access Control

Key Takeaways Explain This Topic AI

Origin Access Control (OAC) replaces legacy Origin Access Identity (OAI) by utilizing AWS Signature Version 4 (SigV4), supporting all AWS Regions, server-side encryption with AWS KMS (SSE-KMS), and HTTP methods beyond GET and HEAD including PUT and DELETE.

S3 bucket policies for OAC must grant s3:GetObject (and s3:PutObject when client uploads are routed through CloudFront) to the cloudfront.amazonaws.com service principal, conditioned on a StringEquals check matching AWS:SourceArn to the CloudFront distribution ARN.

CloudFront response headers policies inject defensive security headers (HSTS, CSP, X-Content-Type-Options, X-Frame-Options) natively at edge points of presence with zero compute cost or latency compared to Lambda@Edge or CloudFront Functions.

Viewer protocol policy enforces encrypted transport with redirect-to-https (HTTP 301) or https-only (HTTP 403), while the origin protocol policy should require HTTPS with TLSv1.2 or later between CloudFront and custom origins.

Private content delivery utilizes CloudFront Signed URLs for discrete assets and Signed Cookies for multi-resource paths, managed modernly through IAM-managed Trusted Key Groups rather than deprecated AWS root-account CloudFront key pairs.

Last updated: September 2026

5.1 CloudFront Security Headers & Origin Access Control

Securing public-facing web applications begins at the network perimeter. Amazon CloudFront is a global Content Delivery Network (CDN) that terminates client transport connections across hundreds of Points of Presence (PoPs). In an enterprise security architecture, CloudFront acts as both a performance accelerator and a defensive shield. It isolates backend application origins, enforces strict transport encryption, filters geographic traffic, and injects critical browser-hardening headers.

Mastering CloudFront edge security for the AWS Certified Security – Specialty exam requires deep technical knowledge of Origin Access Control (OAC) versus legacy Origin Access Identity (OAI) , bucket policy authorization patterns, response headers policies, viewer and origin protocol policies, and cryptographic private content distribution using Signed URLs and Signed Cookies .

Response Headers Policies: Edge-Native Browser Hardening

Modern web browsers implement robust security controls governed by HTTP response headers. Historically, injecting security headers into web responses required modifying origin application source code, configuring origin web server daemons (e.g., Apache or NGINX), or deploying compute-intensive Lambda@Edge or CloudFront Functions to modify responses on viewer-response events.

CloudFront Response Headers Policies eliminate edge compute overhead and latency by natively adding or overriding HTTP response headers directly at edge PoPs before responses are delivered to viewers.

Loading diagram...

Core Defensive Security Headers

When configuring a response headers policy (either using the AWS managed SecurityHeadersPolicy or a custom policy), security engineers enforce the following standard defensive headers:

Security Header Directive Example Defensive Security Function

Strict-Transport-Security (HSTS) max-age=31536000; includeSubDomains; preload Forces modern browsers to communicate exclusively over HTTPS for the specified duration (e.g., 1 year), mitigating man-in-the-middle (MitM) attacks, SSL stripping, and cookie interception. The preload directive allows domain inclusion in browser hardcoded HSTS lists.

Content-Security-Policy (CSP) default-src 'self'; script-src 'self' https://trusted.cdn.com; frame-ancestors 'none'; Restricts the sources from which scripts, styles, images, and frames can be loaded. Prevents Cross-Site Scripting (XSS), malicious iframe embedding, and data injection attacks. Modern CSP frame-ancestors supersedes legacy X-Frame-Options.

X-Content-Type-Options nosniff Disables browser MIME-type sniffing. Forces the browser to strictly adhere to the declared Content-Type header, preventing attackers from disguising executable scripts or HTML inside user-uploaded image or text files.

X-Frame-Options DENY or SAMEORIGIN Mitigates clickjacking attacks by preventing malicious third-party websites from rendering the application inside an <iframe> , <frame> , <embed> , or <object> container.

Referrer-Policy strict-origin-when-cross-origin Controls how much referrer metadata (such as full path and query string parameters containing sensitive tokens) is transmitted in the Referer header during navigation to external origins.

Permissions-Policy geolocation=(), camera=(), microphone=() Explicitly disables sensitive browser features, hardware sensors, and Web APIs across the origin and embedded third-party frames.

Managed vs Custom Response Headers Policies

AWS provides preconfigured managed policies, including Managed-SecurityHeadersPolicy and Managed-CORS-and-SecurityHeadersPolicy . However, enterprise applications frequently require custom response headers policies to tailor CSP directives to internal content repositories or specify custom Access-Control-Allow-Origin values. Crucially, a response headers policy can be configured with Override = true or Override = false :

If Override is set to true , CloudFront replaces any corresponding header returned by the origin.

If Override is set to false , CloudFront injects the configured header only if the origin response does not already contain it.

Exam Tip : For the exam, recognize that CloudFront Response Headers Policies are the AWS recommended best practice for inserting security headers. They execute with zero compute cost and lower latency than Lambda@Edge or CloudFront Functions. Do not choose edge compute solutions for static header injection unless dynamic runtime calculation (such as inspecting user session tokens to construct unique per-user CSP nonces) is explicitly required.

Origin Access Control (OAC) vs Origin Access Identity (OAI)

When using Amazon S3 as a CloudFront origin, public read access must be disabled on the S3 bucket to prevent users from bypassing CloudFront caching, geographic restrictions, and AWS WAF inspection. Securing this communication requires an origin authorization mechanism.

Origin Access Identity (OAI) was the legacy mechanism introduced in earlier AWS architecture. Origin Access Control (OAC) is the modern, secure replacement introduced to overcome severe cryptographic and operational limitations of OAI.

Loading diagram...

Architectural Comparison: OAC vs OAI

Technical Dimension Legacy Origin Access Identity (OAI) Modern Origin Access Control (OAC)

Request Signing Legacy OAI identity (requests are not SigV4-signed by a service principal) AWS Signature Version 4 (SigV4) signed by cloudfront.amazonaws.com

AWS KMS Support (SSE-KMS) Unsupported . S3 buckets encrypted with customer-managed KMS keys cannot be accessed via OAI. Fully Supported . OAC signs requests with SigV4, allowing S3 to validate permissions against KMS key policies.

AWS Regional Support Not supported for S3 buckets in opt-in Regions launched after December 2022. All AWS Regions supported globally, including opt-in Regions.

HTTP Methods Supported Designed for reads ( GET , HEAD ); AWS documents dynamic PUT and DELETE to S3 as an OAC capability. Supports GET , HEAD , OPTIONS , PUT , POST , PATCH , and DELETE for edge uploads.

Supported Origins Amazon S3 only. Amazon S3 , AWS Elemental MediaStore , and AWS Lambda function URLs .

Signing Behavior Options Fixed legacy behavior. Configurable: always , never , or no-override (preserves existing authorization header from client).

Why OAI Fails with SSE-KMS

Understanding the mechanics of the SSE-KMS limitation is a cornerstone of the SCS-C03 exam. When an S3 object is encrypted with AWS Key Management Service ( aws:kms ), S3 must invoke kms:Decrypt using the identity of the caller. AWS lists SSE-KMS support as an OAC capability that OAI lacks: OAI requests are not SigV4-signed by the CloudFront service principal, so there is no principal a KMS key policy can authorize for the distribution. Requests through OAI for SSE-KMS objects therefore fail with Access Denied .

In contrast, OAC generates a full SigV4 signature using the CloudFront service principal ( cloudfront.amazonaws.com ). S3 evaluates this signature against its bucket policy and forwards the caller context to AWS KMS, which evaluates the KMS key policy granting decryption rights to CloudFront.

S3 Bucket Policy & KMS Key Policy Architecture for OAC

To lock down an S3 bucket so that objects are accessible exclusively through an authorized CloudFront distribution using OAC, two policies must be configured: the S3 Bucket Policy and, if SSE-KMS is enabled, the AWS KMS Key Policy .

S3 Bucket Policy Implementation

The S3 bucket policy must grant s3:GetObject permissions to the cloudfront.amazonaws.com service principal. To prevent the Confused Deputy Problem —where an attacker provisions their own CloudFront distribution in another AWS account pointing at your bucket—the policy must enforce an AWS:SourceArn condition matching the specific distribution ARN: {

  • "Version": "2012-10-17",
  • "Statement": [
  • {
  • "Sid": "AllowCloudFrontServicePrincipalReadOnly",
  • "Effect": "Allow",
  • "Principal": {
  • "Service": "cloudfront.amazonaws.com"
  • },
  • "Action": "s3:GetObject",
  • "Resource": "arn:aws:s3:::production-secure-content-bucket/*",
  • "Condition": {
  • "StringEquals": {
  • "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE"
  • }
  • }
  • }
  • ]
  • }

Exam Trap : Pay close attention to the Resource ARN in the bucket policy. The action s3:GetObject applies to objects inside the bucket ( arn:aws:s3:::bucket-name/* ), not the bucket itself ( arn:aws:s3:::bucket-name ). Omitting the /* wildcard results in an Access Denied error when CloudFront fetches objects. If the distribution supports file uploads via PUT or POST , you must also include s3:PutObject in the Action array.

AWS KMS Key Policy for SSE-KMS Encryption

If the S3 bucket is encrypted using a customer-managed key (CMK), the KMS key policy must grant CloudFront permission to decrypt the data keys. Using the default AWS-managed key aws/s3 will not work because the AWS-managed key policy cannot be modified to grant permissions to the CloudFront service principal.

  • The customer-managed KMS key policy must contain the following statement: {
  • "Sid": "AllowCloudFrontServicePrincipalKMSDecryption",
  • "Effect": "Allow",
  • "Principal": {
  • "Service": "cloudfront.amazonaws.com"
  • },
  • "Action": [
  • "kms:Decrypt",
  • "kms:GenerateDataKey*"
  • ],
  • "Resource": "*",
  • "Condition": {
  • "StringEquals": {
  • "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE"
  • }
  • }
  • }
  • Viewer & Origin Protocol Policies

CloudFront sits between viewers (clients) and origins. Transport security must be configured across both network segments.

Loading diagram...

Viewer Protocol Policy

The Viewer Protocol Policy governs how CloudFront responds to client connections over HTTP:

redirect-to-https : If a viewer sends an unencrypted HTTP request, CloudFront automatically responds with an HTTP status code 301 Moved Permanently redirecting the client to the HTTPS equivalent URL on port 443. This provides the best user experience for human web visitors who type plain domain names into address bars.

https-only : CloudFront terminates the connection or returns an HTTP status code 403 Forbidden if a request arrives over unencrypted HTTP. This is standard for REST APIs, mobile backends, and programmatic machine-to-machine integrations where clients must never transmit credentials or payloads over cleartext.

allow-all : CloudFront accepts both HTTP and HTTPS requests without redirecting. This is an anti-pattern in security architectures and should never be used for protected workloads.

Origin Protocol Policy

The Origin Protocol Policy governs the connection between CloudFront edge PoPs and custom origins (such as an Application Load Balancer or EC2 instance):

https-only : CloudFront initiates connections to the origin strictly over TLS port 443, regardless of the protocol used by the viewer. This ensures end-to-end encryption.

match-viewer : CloudFront mirrors the viewer's protocol. If the viewer connected via HTTP, CloudFront calls the origin via HTTP. If the viewer connected via HTTPS, CloudFront calls the origin via HTTPS.

Origin SSL Protocols : Security engineers configure the minimum SSL/TLS version supported between CloudFront and the origin (e.g., enforcing TLSv1.2 or TLSv1.3 and disabling legacy TLSv1.0 and TLSv1.1 ).

Host Header and Certificate Validation : When CloudFront connects to a custom origin over HTTPS, it validates the origin server's TLS certificate. The domain name on the origin's certificate must match the Origin Domain Name configured in the CloudFront distribution settings.

Private Content Distribution: Signed URLs vs Signed Cookies

To restrict access to premium, subscription-based, or confidential content, CloudFront provides two cryptographic mechanisms: Signed URLs and Signed Cookies .

Architectural Comparison

Feature Signed URLs Signed Cookies

Primary Use Case Individual files, direct downloads, media players that do not support cookies, or links shared via email. Providing access to multiple restricted files (e.g., an entire subscriber section https://example.com/courses/module-1/* ) or a single page with dozens of embedded assets.

URL Appearance URLs are modified to append query string parameters containing policy, signature, and key ID. URLs remain clean and standard; authentication data is carried in HTTP Cookie request headers.

Client Support Universal. Any HTTP client, mobile app, or media streaming library supports URL query strings. Requires a client capable of storing and sending HTTP cookies (standard web browsers). Often problematic for smart TVs or embedded media players.

Caching Behavior Every signed URL containing distinct query parameters can bypass edge cache unless query string forwarding is specifically tuned. Content can be cached at the edge by URL path; edge PoPs validate cookies locally before serving cached content.

Canned Policy vs Custom Policy

Both signed URLs and signed cookies can be constructed using either a Canned Policy or a Custom Policy : Canned Policy Attributes:

  • Resource URL (exact match, no wildcards)
  • Expiration Date/Time (Epoch timestamp)

Custom Policy Attributes:

  • Resource URL (supports wildcards, e.g., https://example.com/premium/*)
  • Expiration Date/Time (Epoch timestamp)
  • Optional: Activation Date/Time (Epoch timestamp - link valid only starting in the future)
  • Optional: IP Address Restriction (CIDR block, e.g., 198.51.100.0/24)

Exam Tip : If an exam question requires granting temporary access to a single video file that expires in 15 minutes, choose a Signed URL with a Canned Policy . If the scenario requires granting access to an entire directory of files, restricting access to a corporate IP address range, or setting a future start time, you must use a Custom Policy (with Signed Cookies or Signed URLs).

Trusted Key Groups vs Legacy Trusted Signers

When verifying signatures on signed URLs or cookies, CloudFront must validate the signature against a public key:

Legacy Trusted Signers : Required an AWS account root user to create CloudFront key pairs in the AWS account management console. Sharing keys required adding AWS account IDs as trusted signers. Security anti-pattern : Violates the principle of avoiding root user usage.

Trusted Key Groups (Current Standard) : Allows security engineers to create an asymmetric public-private key pair (RSA 2048-bit), upload the public key to CloudFront using the CreatePublicKey API, and add the public key to a Key Group ( CreateKeyGroup ). IAM users or roles with appropriate permissions can rotate keys programmatically without root account access.

CloudFront Geographic Restrictions

Organizations frequently face regulatory mandates (e.g., export compliance, OFAC sanctions) or digital rights licensing agreements that require restricting access by geographic origin.

CloudFront offers built-in Geographic Restrictions (Geo-blocking):

Allowlist : Only viewers in specified countries (identified by two-letter ISO 3166-1 alpha-2 country codes) can access content. Viewers from any other country receive an HTTP 403 Forbidden response.

Blocklist : Viewers in specified countries are denied access with an HTTP 403 Forbidden response, while viewers from all other countries are permitted.

Edge Evaluation : Geographic restrictions are evaluated directly at the edge PoP using an internal GeoIP database before the request reaches the cache or origin.

CloudFront Geo-Restriction vs AWS WAF Geo-Match

Dimension CloudFront Built-in Geo-Restriction AWS WAF Geo-Match Rule

Granularity Coarse: Applies across the entire distribution or cache behavior. Highly granular: Can be scoped to specific URI paths, HTTP methods, or query parameters.

Rule Logic Simple binary choice: Global Allowlist OR Global Blocklist. Complex Boolean logic: Can combine country match with IP reputation, rate limits, headers, or bot tokens.

Actions Fixed HTTP 403 Forbidden response. Flexible: Block (custom HTML/JSON error page), Allow , Count , CAPTCHA , or Challenge .

Cost No additional charge. Incurs standard AWS WAF WebACL and rule evaluation fees.

Specialty Exam Pitfalls & Architectural Traps

Migrating from OAI to OAC without Updating Bucket Policies : When updating a CloudFront distribution from OAI to OAC, the S3 bucket policy must be updated to grant permissions to cloudfront.amazonaws.com with AWS:SourceArn . If you switch the distribution origin to OAC while retaining the old OAI principal ( arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity EXXXXX ), all origin requests will immediately fail with HTTP 403.

Confused Deputy in OAC Bucket Policies : A bucket policy that grants s3:GetObject to cloudfront.amazonaws.com without a Condition block containing AWS:SourceArn or AWS:SourceAccount allows any CloudFront distribution in any AWS account to read your bucket objects. Always enforce AWS:SourceArn targeting your specific distribution ARN.

Using AWS-Managed Keys ( aws/s3 ) with CloudFront OAC : S3 server-side encryption with AWS-managed keys ( SSE-KMS using alias/aws/s3 ) does not allow modifying the key policy. Because CloudFront OAC requires explicit kms:Decrypt permissions granted in the KMS key policy, you must use a customer-managed key (CMK) when encrypting S3 objects intended for OAC distribution.

Cookie Domain Scope for Signed Cookies : When issuing CloudFront signed cookies, the Domain attribute in the Set-Cookie header must match or be a parent domain of the CloudFront distribution domain (e.g., Domain=.example.com for cdn.example.com ). If the domain attributes mismatch, the browser will not send the cookies on subsequent asset requests, resulting in HTTP 403 errors.

Loading diagram... CloudFront Origin Access Control (OAC) with SSE-KMS & Edge Security Enforcement