DDoS resiliency best practices
The AWS best practices for DDoS resiliency, BP1 to BP7, edge location mitigation, infrastructure and application layer defense, and attack surface reduction.
The reference architecture
AWS's DDoS resiliency whitepaper numbers its best practices BP1 to BP7:
- BP1: CloudFront and Global Accelerator;
- BP2: AWS WAF;
- BP3: Route 53;
- BP4: API Gateway;
- BP5: security groups and network ACLs (in the VPC);
- BP6: Elastic Load Balancing;
- BP7: Auto Scaling.
Edge location mitigation (BP1, BP3)
- BP1, CloudFront:
- web application delivery at the edge;
- protects from common DDoS attacks (SYN floods, UDP reflection…).
- BP1, Global Accelerator:
- access the application from the edge;
- integrates with Shield for DDoS protection;
- helpful if the backend isn't compatible with CloudFront (non-HTTP).
- BP3, Route 53:
- domain name resolution at the edge;
- a DDoS protection mechanism.
Best practices for DDoS mitigation
- Infrastructure layer defense (BP1, BP3, BP6):
- protect EC2 against high traffic;
- that includes using Global Accelerator, Route 53, CloudFront, Elastic Load Balancing.
- EC2 with Auto Scaling (BP7): helps scale in case of sudden traffic surges, including a flash crowd or a DDoS attack.
- Elastic Load Balancing (BP6): scales with traffic increases and distributes the traffic to many EC2 instances.
Application layer defense
- Detect and filter malicious web requests (BP1, BP2):
- CloudFront caches static content and serves it from edge locations, protecting the backend;
- AWS WAF on CloudFront and the ALB filters and blocks requests based on request signatures;
- WAF rate-based rules automatically block the IPs of bad actors;
- use managed rules on WAF to block attacks based on IP reputation, or block anonymous IPs;
- CloudFront can block specific geographies.
- Shield Advanced (BP1, BP2, BP6): its automatic application layer DDoS mitigation creates, evaluates and deploys WAF rules to mitigate layer 7 attacks.
Attack surface reduction
- Obfuscate AWS resources (BP1, BP4, BP6): use CloudFront, API Gateway and Elastic Load Balancing to hide the backend resources (Lambda functions, EC2 instances).
- Security groups and network ACLs (BP5):
- filter traffic based on specific IPs at the subnet or ENI level;
- Elastic IPs are protected by AWS Shield Advanced.
- Protect API endpoints (BP4):
- hide EC2, Lambda and other backends;
- edge-optimized mode, or CloudFront + Regional mode (more control for DDoS);
- WAF + API Gateway: burst limits, header filtering, API keys.
Real-world examples
- A ticketing site expects a flash crowd at 10:00. CloudFront caches the event pages, a WAF rate-based rule limits each IP, and the Auto Scaling group behind the ALB scales out. When attack traffic arrives at the same time, the edge absorbs most of it.
Exam tips
- "Protect a web app from DDoS" → CloudFront (+ WAF rate-based rules) in front, ALB + Auto Scaling behind, Shield Advanced for more.
- "Non-HTTP app needs edge DDoS protection" → Global Accelerator (+ Shield).
- "Hide the backend" → put CloudFront, API Gateway or a load balancer in front, and lock down security groups.
Common traps
- "Expose EC2 instances directly and rely on security groups." Put edge services and a load balancer in front to absorb and filter attacks.
Check yourself
Put AWS Global Accelerator in front (edge entry with Shield protection), add Shield Advanced for the Elastic IPs and accelerator, and keep tight security groups and NACLs on the servers.
AWS documentation
WAF, Shield and Firewall Manager
AWS WAF web ACLs and rules for layer 7 protection, a fixed IP with WAF through Global Accelerator, AWS Shield Standard and Advanced against DDoS, and AWS Firewall Manager for rules across an organization.
GuardDuty, Inspector and Macie
Amazon GuardDuty for intelligent threat detection, Amazon Inspector for automated vulnerability scanning of EC2, container images and Lambda, and Amazon Macie for finding sensitive data in S3.