Mitigating DDoS and Layer 7 Attacks in Layers
This lesson explains the layered protection that large internet-facing applications need, absorbing volumetric attacks at the edge and filtering malicious requests before they reach origins.
Learning outcomes
After completing this lesson, you will be able to:
- Describe layers of protection at the edge network, application and origin.
- Explain how attackers are prevented from bypassing the edge to the origin.
- Harden a public application with Shield Advanced and WAF.
Layers of protection
Protection against DDoS and application attacks is built in layers. At the edge network, CloudFront, Route 53 and Global Accelerator absorb large network and transport layer (layer 3 and 4) attacks at edge locations, away from your VPCs, and Shield Standard protects every customer automatically. At layer 7, AWS WAF inspects HTTP requests. Its managed rule groups cover the OWASP core rule set, known bad inputs, SQL injection, IP reputation and anonymous IPs. Rate-based rules with custom keys stop request floods, Bot Control handles bots, and Fraud Control protects login and sign-up pages. CAPTCHA and challenge actions separate people from scripts.
Shield Advanced adds protection for CloudFront, Route 53, Global Accelerator, load balancers and Elastic IPs. It provides 24/7 access to the Shield Response Team with proactive engagement, cost protection against scaling charges caused by an attack, and automatic application layer mitigation that deploys WAF rules during an attack, as well as health-based detection and attack visibility. The following table summarises the layers.
| Layer | Protection |
|---|---|
| Edge network | CloudFront, Route 53 and Global Accelerator absorb large layer 3 and 4 attacks away from your VPCs; Shield Standard protects everyone automatically |
| Layer 7 (AWS WAF) | Managed rule groups (core rule set for OWASP, known bad inputs, SQL injection, IP reputation, anonymous IPs), rate-based rules with custom keys, Bot Control, Fraud Control (Account Takeover Prevention, Account Creation Fraud Prevention), CAPTCHA and challenge |
| Shield Advanced | Protects CloudFront, Route 53, Global Accelerator, ELB and Elastic IPs: the Shield Response Team 24/7 with proactive engagement, cost protection, automatic application-layer mitigation (deploys WAF rules during attacks), health-based detection, attack visibility |
The following diagram shows the layers a request passes through before it reaches the application.

DDoS defences
Protecting origins
Edge protection works only if attackers cannot bypass the edge and reach the origin directly. An S3 origin uses origin access control (OAC), so the bucket accepts requests only from the distribution. Load balancers and instances in private subnets are reached through CloudFront VPC origins, so they have no public address at all. A public ALB that must stay internet-facing allows only the CloudFront origin-facing managed prefix list in its security group and checks a secret custom header that the distribution adds.
Behind the edge, Auto Scaling and serverless back ends absorb surges that still get through, and the lesson Protecting Origins Behind Amazon CloudFront describes these mechanisms in detail.
Hardening a public application against DDoS
A ticketing site expects attacks during major on-sales. The architect puts CloudFront in front of a private ALB (a CloudFront VPC origin), attaches a WAF web ACL, and subscribes to Shield Advanced. The web ACL is ordered so cheap, decisive rules run first:
Priority Rule Action
0 IP set: known bad addresses Block
1 AWSManagedRulesAmazonIpReputationList Block
2 Rate-based: 2,000 req / 5 min per IP Block (CAPTCHA on /checkout)
3 AWSManagedRulesCommonRuleSet Block
4 AWSManagedRulesKnownBadInputsRuleSet Block
5 AWSManagedRulesBotControlRuleSet Challenge for unverified bots
default Allowaws shield create-protection --name tickets-cf --resource-arn $DISTRIBUTION_ARN
aws shield enable-application-layer-automatic-response --resource-arn $DISTRIBUTION_ARN \
--action Block={}
aws shield associate-proactive-engagement-details --emergency-contact-list \
[email protected],PhoneNumber=+441234567890
aws shield enable-proactive-engagementAutomatic application-layer mitigation lets Shield Advanced create and remove WAF rules during an attack; proactive engagement means the Shield Response Team contacts the company when health-based detection sees impact. Because the ALB is private, attackers cannot bypass CloudFront to reach it.
Why does placing CloudFront in front of an application improve DDoS resilience?
Show answer
CloudFront absorbs attacks across AWS's edge network with Shield Standard, and AWS WAF rate-based rules can block layer 7 floods before they reach the origin.
Exam Tips
Remember for the exam
- Automatic layer 7 DDoS mitigation with expert support points to Shield Advanced.
- Credential stuffing on login pages calls for WAF Fraud Control Account Takeover Prevention.
- To keep ALBs reachable only through CloudFront, use CloudFront VPC origins with a private ALB.
- To absorb volumetric attacks, put CloudFront or Global Accelerator in front of the application.
- To protect every public endpoint, combine CloudFront, AWS WAF and Shield Advanced, deployed consistently with StackSets.