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.
AWS WAF
AWS WAF (Web Application Firewall) protects web applications from common web exploits (layer 7).
- Layer 7 is HTTP (vs layer 4, which is TCP/UDP).
- Deploy on:
- Application Load Balancer;
- API Gateway (REST APIs);
- CloudFront;
- AppSync GraphQL API;
- Cognito user pool;
- and newer targets such as App Runner, Verified Access and Amplify.
- Define web ACL (web access control list) rules:
- IP sets: up to 10,000 IP addresses each; use multiple rules for more;
- HTTP headers, HTTP body or URI strings: protect from common attacks such as SQL injection and cross-site scripting (XSS);
- size constraints, geo match (block countries);
- rate-based rules (count occurrences of events), for DDoS protection.
- Web ACLs are Regional, except for CloudFront (global, managed in us-east-1).
- A rule group is a reusable set of rules that can be added to a web ACL. AWS and partners sell managed rule groups (for example Bot Control, known bad inputs).
The new WAF console calls a web ACL a protection pack; it's the same thing.
Fixed IP while using WAF with a load balancer
- WAF does not support the Network Load Balancer (layer 4), which is the usual answer for fixed IPs.
- Use Global Accelerator for fixed IPs and WAF on the ALB.
- The web ACL must be in the same Region as the ALB.
AWS Shield
DDoS: Distributed Denial of Service, many requests at the same time to overwhelm a system.
- AWS Shield Standard:
- free service, activated for every AWS customer;
- protects from attacks such as SYN/UDP floods, reflection attacks and other layer 3 / layer 4 attacks.
- AWS Shield Advanced:
- optional DDoS mitigation service, about $3,000 per month per organization (with a 1-year commitment);
- protects against more sophisticated attacks on EC2 (Elastic IPs), Elastic Load Balancing, CloudFront, Global Accelerator and Route 53;
- 24/7 access to the AWS Shield Response Team (SRT);
- protects against higher fees during usage spikes caused by DDoS (cost protection);
- automatic application layer DDoS mitigation: automatically creates, evaluates and deploys WAF rules to mitigate layer 7 attacks.
AWS Firewall Manager
AWS Firewall Manager manages rules in all accounts of an AWS Organization.
- Security policy: a common set of security rules:
- WAF rules (ALB, API Gateway, CloudFront);
- Shield Advanced (ALB, CLB, NLB, Elastic IP, CloudFront);
- security groups for EC2, ALB and ENI resources in a VPC (and network ACLs);
- AWS Network Firewall (VPC level);
- Route 53 Resolver DNS Firewall;
- policies are created at the Region level.
- Rules are applied to new resources as they're created (good for compliance), across all and future accounts in the organization.
WAF vs Firewall Manager vs Shield
- WAF, Shield and Firewall Manager are used together for comprehensive protection.
- Define the web ACL rules in WAF.
- For granular protection of resources, WAF alone is the correct choice.
- To use WAF across accounts, accelerate WAF configuration, and automate the protection of new resources, use Firewall Manager with WAF.
- Shield Advanced adds features on top of WAF, such as dedicated support from the Shield Response Team and advanced reporting.
- For workloads prone to frequent DDoS attacks, consider purchasing Shield Advanced.
Real-world examples
- An online shop puts a WAF web ACL on its CloudFront distribution with the AWS managed SQL injection rules and a rate-based rule blocking any IP sending over 2,000 requests in 5 minutes.
- A large enterprise uses Firewall Manager so every ALB created in any of its 200 accounts automatically gets the company's WAF rules.
Exam tips
- "SQL injection", "cross-site scripting", "block countries", "rate limit by IP" → AWS WAF.
- "WAF on a Network Load Balancer" → not possible; use Global Accelerator + ALB with WAF for fixed IPs.
- "DDoS protection at no cost" → Shield Standard (automatic).
- "DDoS response team", "cost protection", "sophisticated DDoS" → Shield Advanced.
- "Apply WAF rules or security groups across all accounts, including new ones" → Firewall Manager.
Common traps
- "Shield Standard has to be enabled." It's on for everyone.
- "WAF protects against layer 4 floods." That's Shield; WAF is layer 7.
- "Web ACLs for CloudFront are created in the distribution's Region." CloudFront web ACLs are global (us-east-1).
Hands-on lab: block a country with WAF
Goal: attach a web ACL with a geo-match rule to a resource and see it block requests.
Costs money
WAF bills by the hour (about $0.01 an hour per protected resource, or $5 a month per web ACL plus $1 per rule on the older pricing, prorated hourly) plus $0.60 per million requests. An hour of testing costs a cent or two, but you need an ALB, API Gateway REST API or CloudFront distribution to attach it to. Use the Region of that resource (or Global for CloudFront).
Create the web ACL
WAF → Web ACLs → Create web ACL, resource type matching your resource, then Add resource.
Add a geo rule
Add my own rules → Rule builder: name block-my-country, statement Originates from a country in your own country, action Block. Default action Allow. Create.
Test it
Open your site or API from your browser.
Expected result: a 403 Forbidden response, and the blocked request counted in the web ACL's overview.
Clean up: disassociate the resource, then delete the web ACL.
AWS documentation
AWS Certificate Manager (ACM)
AWS Certificate Manager for public and private TLS certificates, requesting and validating certificates, automatic renewal, imported certificates and expiry monitoring, and ACM with load balancers and API Gateway.
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.