1.5 AWS WAF, Shield, and Network Firewall

Key Takeaways

  • AWS WAF inspects Layer-7 HTTP/HTTPS traffic and blocks SQL injection, cross-site scripting, bots, and rate-based floods.
  • WAF attaches to CloudFront, Application Load Balancer, API Gateway, AppSync, and Cognito — never to NLB or EC2 directly.
  • AWS Shield Standard gives free, automatic Layer-3/4 DDoS protection; Shield Advanced adds Layer-7 defense, cost protection, and 24/7 SRT access for about $3,000/month.
  • AWS Network Firewall provides stateful and stateless packet inspection, intrusion prevention, and domain filtering for VPC traffic.
  • AWS Firewall Manager centrally enforces WAF, Shield Advanced, security groups, and Network Firewall policies across an Organization.
Last updated: June 2026

Quick Answer: WAF blocks Layer-7 web exploits and attaches to CloudFront/ALB/API Gateway. Shield defends against DDoS — Standard is free, Advanced is ~$3,000/month with cost protection and a Shield Response Team. Network Firewall inspects packets inside the VPC. Firewall Manager governs all three across accounts.

AWS WAF (Web Application Firewall)

AWS WAF filters HTTP(S) requests at the application layer (Layer 7) using rules organized in a Web ACL (Access Control List).

ThreatWAF Rule
SQL injectionSQLi match statement / SQL Database managed group
Cross-site scripting (XSS)XSS match statement
Malicious IPsIP set rule (allow/block)
Geographic blockingGeo-match statement
HTTP floodsRate-based rule (e.g., 2,000 requests / 5 min per IP)
BotsBot Control managed rule group
Known bad inputsAWS Managed Rules (threat intel)

Integration Targets (memorize the list)

ServiceScope
Amazon CloudFrontGlobal edge
Application Load BalancerRegional
Amazon API GatewayRegional
AWS AppSyncRegional (GraphQL)
Amazon Cognito user pools / App RunnerRegional

On the Exam: WAF does NOT attach to a Network Load Balancer (NLB) or to EC2 directly — both are Layer-4 / instance-level. If a scenario uses an NLB and needs Layer-7 filtering, the design must put a WAF-capable layer (ALB or CloudFront) in front.

A Web ACL holds rules and rule groups and a default action (Allow or Block) for unmatched requests. AWS Managed Rules include the Core Rule Set (OWASP Top 10), Known Bad Inputs, SQL Database, IP Reputation, and Bot Control — using them avoids hand-writing common protections.

AWS Shield

AWS Shield is the managed Distributed Denial of Service (DDoS) protection service.

FeatureShield StandardShield Advanced
CostFree, always on~$3,000/month (1-year commit) + data transfer
Layers3/43/4/7
Protected resourcesAll AWS edge/networkEC2, ELB, CloudFront, Global Accelerator, Route 53
Response teamNo24/7 Shield Response Team (SRT)
Cost protectionNoYes — credits for DDoS-driven scaling charges
WAFSeparate costWAF included at no extra charge

On the Exam: "Protect against DDoS and get billing credits for Auto Scaling spikes during an attack" → Shield Advanced. "Basic, no-cost DDoS protection" → Shield Standard (already enabled).

AWS Network Firewall

AWS Network Firewall is a managed, stateful VPC firewall for Layer-3/4 and some Layer-7 inspection.

CapabilityDetail
InspectionStateful and stateless packet filtering
RulesProtocol, port, IP, domain-name allow/deny lists
IPS/IDSSuricata-compatible signatures (intrusion prevention/detection)
TLS inspectionOptional decrypt-and-inspect
DeploymentDedicated firewall subnet, often with a Transit Gateway hub
ScalingFully managed, auto-scaling

Use it to stop data exfiltration, block egress to known-bad domains, or inspect east-west traffic between VPCs — things SGs and NACLs cannot do because they filter only by IP/port, not by content or domain.

AWS Firewall Manager

AWS Firewall Manager centrally applies and audits protections across an entire AWS Organization (which is a prerequisite).

ManagesExample Policy
WAFDeploy one Web ACL to every ALB org-wide
Shield AdvancedEnforce Advanced on all in-scope resources
Security groupsAudit and remediate overly permissive rules
Network FirewallStandardize VPC firewall rules
Route 53 Resolver DNS FirewallOrg-wide DNS filtering

On the Exam: "Enforce the same WAF rules automatically on every new account/ALB across the organization" → Firewall Manager, not per-account WAF.

Where Each Layer Lives in the Request Path

Understanding the order of inspection clarifies which service answers a question. A request to a global web app typically flows: client → Shield (edge, automatic) → CloudFront → WAF (Web ACL evaluated here) → origin (ALB) → security groups → instance. WAF inspects HTTP content; Shield absorbs volumetric floods before they reach your origin; security groups and NACLs filter at the network layers; and Network Firewall sits inside the VPC inspecting east-west and egress traffic that the edge services never see.

Mapping a threat to the correct layer is the recurring skill: SQL injection is Layer 7 → WAF, a 100-Gbps UDP flood is Layer 3/4 → Shield, and outbound traffic to a malicious domain is VPC egress → Network Firewall.

WAF Rule Priority and Actions

Within a Web ACL, rules run in priority order (lowest number first), and the first terminating action — Allow or Block — stops evaluation. A Count action is non-terminating and is used to test a new rule's impact safely before switching it to Block. A common design mistake is placing a broad Allow rule above a specific Block rule, so the malicious request matches Allow first and is never blocked — order rate-based and managed protection rules above permissive rules.

Rate-Based Rules and Bot Control

A rate-based rule tracks requests per source IP over a rolling 5-minute window and blocks IPs that exceed the threshold (for example, 2,000 requests), automatically releasing them when the rate subsides. This is the standard answer for mitigating an HTTP flood / Layer-7 DDoS at the application tier, complementing Shield's network-layer defense. For automated and targeted bots (scrapers, credential stuffing), the Bot Control managed rule group adds detection beyond simple rate limiting.

Service Selection Cheat Sheet

Threat / NeedService
SQL injection, XSS, bad inputsAWS WAF
Volumetric Layer 3/4 DDoS, freeShield Standard
Layer 7 DDoS + cost protection + SRTShield Advanced
Inspect/block VPC egress by domainNetwork Firewall
Org-wide enforcement of the aboveFirewall Manager
Filter DNS queries to bad domainsRoute 53 Resolver DNS Firewall

Common Trap: WAF and Shield are complementary, not interchangeable. A question that asks to stop SQL injection is never solved by Shield, and one asking for DDoS cost protection is never solved by WAF alone.

Test Your Knowledge

A public web application behind an Application Load Balancer must be protected against SQL injection and cross-site scripting. What should you deploy?

A
B
C
D
Test Your Knowledge

Which AWS Shield tier provides cost protection, crediting back charges from DDoS-driven Auto Scaling during an attack?

A
B
C
D
Test Your Knowledge

An application is exposed through a Network Load Balancer, and the team wants AWS WAF to filter requests. What is the correct conclusion?

A
B
C
D