Servisphere
AWS WAF icon (AWS Architecture Icons)

AWS WAF

Web firewall

Filters malicious HTTP requests (SQL injection, XSS, bots, bad IPs) before they reach CloudFront, ALB, API Gateway.

  • Cost$$ Medium
  • Difficulty●●●●●
  • Costs money when idle?Yes
  • Managed by AWS
  • In examsCLF · SAA · SOA

Scope: Global (with CloudFront) or Regional

Open WAF on the map →
Think of it asLike a gate guard checking people against a blacklist and suspicious signs.

Where does WAF fit?

See the full map →

A real example, step by step

  1. A bot is trying thousands of passwords per minute against your login page.
  2. You create a web ACL in AWS WAF and attach it to the CloudFront distribution in front of the site.
  3. You turn on AWS managed rules that block SQL injection and XSS, without writing rules yourself.
  4. A rate-based rule blocks any IP that sends more than 300 requests to /login within 5 minutes.
  5. The bot is stopped at the edge; bad requests never reach your servers.

▶ Watch the “Who protects what” scenario on the map

When to use it

✓ Use it when

Public web applications.

✗ Avoid it when

Network-layer DDoS protection → Shield; filtering traffic inside a VPC → Network Firewall.

Common uses

  • Block SQL injection, XSS with managed rules
  • Rate limiting against brute-force and bots
  • Block by IP or country

WAF, VPC or CloudFront?

WAFVPCCloudFront
Protects atApplication layer (HTTP): SQL injection, XSS, botsNetwork: IPs, ports (security groups, NACLs)Content delivery; Shield Standard blocks DDoS by default
Attaches toCloudFront, ALB, API Gateway, AppSync, Cognito…Resources inside the VPCSits in front of the website
Understands request contentYes (path, headers, body)NoPartly (caching by path, headers)
BillingPer web ACL, rule and requestSecurity groups are freePer data transferred

What does it cost?

Example1 web ACL, 5 rules, 10 million requests ≈ $5 + $5 + $6 = $16/month.
  • Pricing model: $5/web ACL/month + $1/rule/month + $0.60/1 million requests. Advanced rule sets (Bot Control, Fraud Control) cost extra.
  • Free tier: None.
⚠️ Cost traps

Bot Control/Fraud Control per-request charges are fairly expensive; creating a separate web ACL per environment.

Reference prices for us-east-1, updated October 14, 2026; they may have changed. Always check the AWS pricing page. Official AWS pricing page ↗

💡 Exam tip

Block SQL injection or XSS, rate-limit a single IP, block by country → WAF. Network-layer DDoS protection → Shield (Advanced if you need response support and cost protection). WAF can't be attached to EC2 or an NLB.

Try real exam questions

AWS certification exams are in English, so the questions are shown as they appear on the exam.

1A company's web application consists of multiple Amazon EC2 instances that run behind an Application Load Balancer in a VPC. An Amazon RDS for MySQL DB instance contains the data. The company needs the ability to automatically detect and respond to suspicious or unexpected behavior in its AWS environment. The company already has added AWS WAF to its architecture. What should a solutions architect do next to protect against threats?

  1. AUse Amazon GuardDuty to perform threat detection. Configure Amazon EventBridge (Amazon CloudWatch Events) to filter for GuardDuty findings and to invoke an AWS Lambda function to adjust the AWS WAF rules.
  2. BUse AWS Firewall Manager to perform threat detection. Configure Amazon EventBridge (Amazon CloudWatch Events) to filter for Firewall Manager findings and to invoke an AWS Lambda function to adjust the AWS WAF web ACL.
  3. CUse Amazon Inspector to perform threat detection and to update the AWS WAF rules. Create a VPC network ACL to limit access to the web application.
  4. DUse Amazon Macie to perform threat detection and to update the AWS WAF rules. Create a VPC network ACL to limit access to the web application.
Show answer

Correct answer: A

GuardDuty detects suspicious behavior; EventBridge catches its findings and invokes Lambda to update the WAF rules automatically. Inspector scans software vulnerabilities and Macie finds sensitive data; neither is a threat detector.

2A company runs a web application on Amazon EC2 instances in an Auto Scaling group that has a target group. The company designed the application to work with session affinity (sticky sessions) for a better user experience. The application must be available publicly over the internet as an endpoint. A WAF must be applied to the endpoint for additional security. Session affinity (sticky sessions) must be configured on the endpoint. Which combination of steps will meet these requirements? (Choose two.)

  1. ACreate a public Network Load Balancer. Specify the application target group.
  2. BCreate a Gateway Load Balancer. Specify the application target group.
  3. CCreate a public Application Load Balancer. Specify the application target group.
  4. DCreate a second target group. Add Elastic IP addresses to the EC2 instances.
  5. ECreate a web ACL in AWS WAF. Associate the web ACL with the endpoint.
Show answer

Correct answer: C, E

A public Application Load Balancer supports sticky sessions and can have an AWS WAF web ACL attached. NLBs and Gateway Load Balancers can't have WAF attached.

Practice 700+ more questions on Servisphere →

Frequently asked questions

What is the difference between WAF and Shield?

WAF filters HTTP requests at the application layer: blocking SQL injection, XSS and bots, and rate-limiting by IP. Shield protects against DDoS; Shield Standard is on for free in every account, while Shield Advanced is paid and adds support from the AWS DDoS response team.

Where can I attach WAF?

To CloudFront, Application Load Balancers, API Gateway REST APIs, AppSync, Cognito user pools, App Runner and Verified Access. WAF can't be attached directly to EC2 or an NLB.

How is WAF priced?

By the number of web ACLs, the rules in each ACL and the requests inspected. Managed rule groups from AWS Marketplace and features such as Bot Control or fraud prevention cost extra.

What do AWS exams ask about WAF?

Blocking SQL injection and XSS with managed rules, rate-based rules against floods from a single IP, geo blocking, attaching WAF to the right resource, and telling it apart from Shield, Network Firewall and security groups.

Related services

Open WAF on the map →