Edge Security with CloudFront, WAF and Shield
Layered edge protection. WAF rules, Shield DDoS, origin lockdown with OAC and secret headers, and central policy through Firewall Manager.
Exam tasks: 3.1 (edge security strategy, edge protection with CloudFront headers, WAF, IoT policies, OWASP Top 10, S3 CORS and Shield Advanced, rules for geography, rate limiting and client fingerprinting, OCSF and third-party WAF integrations)
The decision: which layer of the attack are you stopping (flood, abusive client, malicious payload, direct origin access), and which edge service stops it before it costs you capacity?
Put the controls where traffic first lands. CloudFront absorbs and caches, AWS WAF filters web requests, Shield mitigates DDoS, and Firewall Manager applies the same policy to every account. Then make the origin accept traffic only from the edge.
Which one to use
| Threat or need | Edge control | Page |
|---|---|---|
| Volumetric layer 3 and 4 flood | Shield Standard (automatic). CloudFront and Route 53 absorb traffic at the edge | Shield |
| Layer 7 flood, DDoS response team, cost protection | Shield Advanced | Shield |
| SQL injection, XSS, OWASP Top 10 payloads | WAF managed rule groups | WAF |
| Abusive client, scraper, credential stuffing | WAF rate-based rules, Bot Control, Fraud Control | WAF |
| Same WAF rules in every account | Firewall Manager | WAF and Firewall Manager |
| Viewers bypassing CloudFront to hit the origin | OAC, VPC origins, secret header | CloudFront edge security |
| Missing security headers | Response headers policy | CloudFront edge security |
| Browser blocked from a cross-origin S3 call | CORS rule on the bucket | S3 CORS |
| Device fleet publishing to AWS IoT | IoT Core policy on the certificate | This page |
AWS WAF
| Item | Detail |
|---|---|
| Protects | CloudFront, ALB, API Gateway REST API, AppSync GraphQL API, Cognito user pool, App Runner, Verified Access, Amplify and Bedrock AgentCore Gateway. Not EC2 directly |
| Container | A web ACL (the console now calls it a protection pack) holds rules and rule groups |
| Capacity | Up to 5,000 WCU per web ACL. Above 1,500 WCU costs more |
| Body inspection | 8 KB for ALB and AppSync. CloudFront, API Gateway, Cognito and others default to 16 KB, adjustable to 64 KB |
| Rate-based rules | Up to 10 per web ACL. Minimum rate is 10 requests |
| Default limits | 100 web ACLs, 100 rule groups, 100 IP sets per Region. 10,000 CIDRs per IP set |
| Blocked response | HTTP 403 by default, or a custom response |
Managed rule groups
| Source | Cost |
|---|---|
| AWS Managed Rules (baseline, use-case specific and IP reputation groups, covering common web exploits such as OWASP Top 10 risks) | No extra charge |
| Bot Control, Account Takeover Prevention (ATP), Account Creation Fraud Prevention (ACFP) | Extra fee |
| AWS Marketplace rule groups from vendors | Subscription priced by the seller |
You cannot read the individual rules in a managed group. AWS updates them as threats appear.
Shield
| Item | Shield Standard | Shield Advanced |
|---|---|---|
| Cost | Included for all customers | Subscription |
| Coverage | Automatic protection against common DDoS attacks | Layers 3, 4 and 7 on resources you explicitly add |
| Resources | Automatic | CloudFront, Route 53 hosted zones, Global Accelerator standard accelerators, Elastic IPs, ALB, Classic LB, NLB (through an Elastic IP) |
| Selection | Nothing to enable | You choose resources, or use a Firewall Manager policy |
Firewall Manager
Needs AWS Organizations. One policy covers WAF, Shield Advanced, security groups, network ACLs, Network Firewall and DNS Firewall. It can protect every resource of a type or with a tag, and automatically covers new resources and accounts. You pay the underlying services such as WAF and AWS Config.
CloudFront origin protection
| Origin | Control |
|---|---|
| S3 | Origin access control (OAC). CloudFront signs requests with SigV4. The bucket policy grants cloudfront.amazonaws.com access with an AWS:SourceArn condition for the distribution. A KMS-encrypted bucket also needs a key policy statement for CloudFront. S3 website endpoints cannot use OAC |
| ALB or custom | Add a custom header with a secret value in CloudFront. Add a WAF rule on the ALB that only passes requests carrying it. Rotate the secret with Secrets Manager |
| Both layers | Put WAF at CloudFront and at the ALB so a direct hit on the ALB is blocked |
OAC supports every Region, SSE-KMS, and PUT and DELETE. The older origin access identity (OAI) does not, so migrate from OAI to OAC.
Exam signal
"Only CloudFront may read the S3 bucket" means OAC with a bucket policy. "Apply WAF rules to every account automatically" means Firewall Manager. "Enhanced DDoS detection and mitigation for an ALB or Elastic IP" means Shield Advanced.
Exam trap
A WAF web ACL cannot be attached to an EC2 instance, a Network Load Balancer or an S3 bucket. Put the workload behind an ALB or CloudFront first.
Legacy
OAI (origin access identity) is the older CloudFront S3 mechanism. Newer features and Regions only work with OAC.
Integrations and third-party rules
- Third-party WAF rules come as AWS Marketplace managed rule groups. Subscribe, then add them to a protection pack like any managed group.
- WAF logs and their
aws-waf-logs-destination naming are covered on AWS WAF and Firewall Manager. - Normalizing WAF and other logs into OCSF is covered on Security Lake and OCSF integrations.
AWS IoT policies
- Devices authenticate to IoT Core with X.509 certificates (or custom authorizers). An IoT Core policy
attached to the certificate authorizes
iot:Connect,iot:Publish,iot:Subscribeandiot:Receive. - Use policy variables such as
iot:Connection.Thing.ThingNamein resource ARNs, so each device can only use its own client ID and topics. A wildcardiot:*on*lets one stolen certificate impersonate the fleet. - Revoke or deactivate a compromised device certificate. AWS IoT Device Defender audits over-permissive policies and shared certificates.
Related
Further reading
Domain 3 · Infrastructure security
18% of the exam. Putting the right control at each layer, from the edge through the network to the workload, without opening more access than the requirement needs.
AWS WAF and Firewall Manager
Layer 7 filtering with web ACLs, rate-based rules and managed rule groups, and org-wide enforcement with Firewall Manager.