AWS WAF (Web Application Firewall) (WAF)
Attaches directly to Application Load Balancers (ALB), Amazon CloudFront distributions, Amazon API Gateways, and AWS AppSync GraphQL endpoints. Inspects full HTTP/HTTPS request bodies, headers, URIs, and query strings against AWS Managed Rule Sets (AMRs) and custom regex rules to block OWASP Top 10 exploits, SQL injections, XSS, rate-limiting floods, and automated bot scrapers.
AWS Container Placement
Regional / Global Managed Scope (Outside VPC Subnets)
Summary
Layer-7 web application firewall monitoring HTTP/HTTPS requests forwarded to protected web applications.
When to Use (SAA-C03)
Place in front of CloudFront, API Gateway, or ALB whenever requirements mention SQL injection, XSS, geo-blocking, or rate limiting.
Allowed Ingress Connections & Ports
| Source Service | Protocol | Port | Architectural Rationale |
|---|---|---|---|
| WEBCLIENT | HTTP, HTTPS | 80, 443 | Public web browsers and API consumers sending web traffic |
| CLOUDFRONT | HTTPS | 443 | CloudFront edge distribution forwarding requests through Web ACL inspection |
Allowed Egress Targets & Ports
| Target Service | Protocol | Port | Data Flow Rationale |
|---|---|---|---|
| ALB | HTTP, HTTPS | 80, 443 | Application Load Balancer receiving clean, verified HTTP traffic |
| APIGW | HTTPS | 443 | Amazon API Gateway receiving inspected REST/WebSocket API calls |
| CLOUDFRONT | HTTPS | 443 | CloudFront cache engine receiving clean viewer requests |
Key Configuration Parameters & AWS Best Practices
| Parameter | Format / Example | Purpose & Rationale |
|---|---|---|
| Scope (scope / wafScope) (Required) | REGIONAL | Specifies whether the Web ACL is deployed for regional resources (ALB, API Gateway, AppSync) or globally for Amazon CloudFront. Why: AWS WAF requires scope at creation; CloudFront Web ACLs must be created in us-east-1, while Regional Web ACLs exist in the local AWS region. |
| Default Action (defaultAction) (Required) | ALLOW | Determines what AWS WAF does with a request if it does not match any of the rules in the Web ACL. Why: Defines the foundational baseline policy (default allow for open sites, default block for strict private APIs). |
| Associated Resource (wafAssociatedResourceId) (Required) | arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-alb/... | The AWS resource protected by this Web ACL. Why: A Web ACL has no protective effect until associated with an entry point. |
| Managed Rule Group (managedRuleGroup) (Required) | AWSManagedRulesCommonRuleSet | Turnkey rule group maintained by AWS Threat Research defending against common web attacks. Why: Provides instant protection against OWASP Top 10 exploits without authoring custom regex expressions. |
| Rate Limit Threshold (wafRateLimitRps) | 500 | Maximum allowable requests from a single IP address over an evaluation window before triggering a block. Why: Protects backend servers against Layer-7 DDoS attacks and aggressive crawlers. |
| Block SQL Injection (wafBlockSqlInjection) | true | Inspects query strings, request bodies, and headers for SQL injection syntax. Why: Protects relational databases from malicious queries and data exfiltration. |
| Blocked Path Prefixes (wafBlockedPathPrefixes) | /admin, /.env, /wp-login.php | URIs that are immediately blocked without evaluating backend routing. Why: Stops automated bots from probing WordPress logins, administrative portals, and exposed environment variables. |
| CloudWatch Metrics (cloudwatch_metrics_enabled) | true | Emits real-time WAF rule metric counts to CloudWatch metrics for alerting and dashboards. Why: Enables monitoring of blocked request spikes and DDoS alarms. |
Practice Labs Using AWS WAF (Web Application Firewall)
Global Video Streaming: CloudFront OAC Origin Shielding & S3 Leak
Enable Origin Access Control (OAC) on CloudFront and enable Block Public Access on the origin S3 bucket.…
BUILD-13Build: Multi-Region CloudFront Edge + WAF + S3 OAC
Design from scratch: Route 53 DNS -> AWS WAF -> CloudFront CDN -> Private S3 Bucket.…
Frequently Asked Questions
Where does AWS WAF (Web Application Firewall) live inside an AWS VPC architecture?
Valid container placement: Regional / Global Managed Scope (Outside VPC Subnets). Attaches directly to Application Load Balancers (ALB), Amazon CloudFront distributions, Amazon API Gateways, and AWS AppSync GraphQL endpoints. Inspects full HTTP/HTTPS request bodies, headers, URIs, and query strings against AWS Managed Rule Sets (AMRs) and custom regex rules to block OWASP Top 10 exploits, SQL injections, XSS, rate-limiting floods, and automated bot scrapers.
When should I use AWS WAF (Web Application Firewall) on the AWS SAA-C03 exam?
Place in front of CloudFront, API Gateway, or ALB whenever requirements mention SQL injection, XSS, geo-blocking, or rate limiting.
Can I simulate AWS WAF (Web Application Firewall) packet routing without an AWS account?
Yes. CloudTracer simulates AWS WAF (Web Application Firewall) along with 53 AWS services directly in your browser and exports production Terraform HCL.