Managed rules
AWS Managed Rules
Use versioned rule groups such as Core rule set, Known bad inputs, SQL database, and IP reputation. Override the action of individual rules in a group, or narrow their scope with a scope-down statement.
AWS WAF · Web application firewall · L7
AWS WAF is a managed web application firewall that inspects HTTP(S) requests sent to resources such as CloudFront, ALB, and API Gateway. You stack rules in a web ACL by priority, and each request is handled with one of Allow, Block, Count, CAPTCHA, or Challenge.
POST /api/login · 203.0.113.7 · UA: python-requests
Count only adds labels and moves on to the next rule. Block ends evaluation and returns a 403.
Rule actions (Allow · Block · Count · CAPTCHA · Challenge)
Capacity included in the base web ACL price (up to 5,000)
Associable resource types
Log destinations (CloudWatch Logs · S3 · Firehose)
Why AWS WAF
Security groups and Network Firewall look at addresses, ports, and flows. SQL injection, credential stuffing, and scraping bots happen inside legitimate HTTPS sessions, so you need an L7 layer that examines headers, query strings, bodies, and client behavior.
No separate appliance or routing changes: associate a web ACL with a resource such as a CloudFront distribution or ALB, and inspection starts immediately.
Use AWS Managed Rules and AWS Marketplace rule groups to block common web exploits, low-reputation IPs, and bots first, then layer custom rules on top.
Add rules in Count mode, check for false positives with CloudWatch metrics, sampled requests, and full logs, then switch them to Block.
Rules · labels
Below is a rate-based rule that limits requests per IP on the login path, excluding requests that carry the corporate-IP label. Using labels added by earlier rules as conditions in later rules lets you split rules into small pieces and combine them.
{
"Name": "rate-limit-login",
"Priority": 4,
"Statement": {
"RateBasedStatement": {
"Limit": 100,
"EvaluationWindowSec": 300,
"AggregateKeyType": "IP",
"ScopeDownStatement": { "AndStatement": { "Statements": [
{ "ByteMatchStatement": { "SearchString": "/api/login",
"FieldToMatch": { "UriPath": {} }, "PositionalConstraint": "STARTS_WITH",
"TextTransformations": [{ "Priority": 0, "Type": "LOWERCASE" }] } },
{ "NotStatement": { "Statement": { "LabelMatchStatement": {
"Scope": "LABEL", "Key": "corp:trusted-ip" } } } }
] } }
}
},
"Action": { "Block": {} }, // Allow is not supported
"VisibilityConfig": { "SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true, "MetricName": "rate-limit-login" }
}
PriorityA web ACL evaluates rules from the lowest number up. It stops at a terminating action such as Allow or Block; if nothing matches, the web ACL default action applies.
LabelCount is a non-terminating action that records the match and moves on to the next rule. Labels added by rules and managed rule groups can be referenced by later rules in the same web ACL with LabelMatchStatement.
60–600sChoose an evaluation window of 60, 120, 300, or 600 seconds; the minimum limit is 10. Requests are aggregated by combining keys such as IP, forwarded IP, headers, query arguments, and label namespaces. It is meant to curb high request rates, not to enforce precise quotas.
Features
Managed rules
Use versioned rule groups such as Core rule set, Known bad inputs, SQL database, and IP reputation. Override the action of individual rules in a group, or narrow their scope with a scope-down statement.
Bot Control
The Common level classifies self-identifying bots and labels them; the Targeted level also catches bots that hide their identity, using browser interrogation and behavioral analysis. Useful bots such as search engines are allowed after verification.
Fraud Control
ATP detects credential stuffing and account takeover attempts on login pages; ACFP detects fake account creation on sign-up pages. Decisions use compromised-credential checks and session-level aggregation.
CAPTCHA · Challenge
CAPTCHA asks the user to solve a puzzle; Challenge silently checks the browser environment. On success, an AWS WAF token is issued and the client isn't asked again during the immunity time.
App integration
With the JavaScript, iOS, and Android SDKs, clients acquire a token in advance and attach it to requests. SDK integration is recommended to get the full benefit of Bot Control Targeted and Fraud Control.
Logging
Send web ACL logs to CloudWatch Logs, Amazon S3, or Amazon Data Firehose. Destination names must start with aws-waf-logs-; use field redaction and log filtering to reduce volume.
L7 DDoS
AWSManagedRulesAntiDDoSRuleSet learns a per-resource traffic baseline and detects L7 DDoS within seconds. Low-suspicion requests are mitigated with a silent Challenge and high-suspicion requests with Block. It is a paid rule group.
AI traffic
Bot Control classifies AI crawlers and agents and shows them in the AI activity dashboard. Bots verified with Web Bot Auth signatures are allowed by default, and on CloudFront you can also charge with HTTP 402 through AI traffic monetization.
Request handling
Dynamic label interpolation inserts label namespaces, client IP, and JA3 · JA4 fingerprints into custom headers or response bodies with a single rule. Pre-parse text transformation normalizes query strings before parsing to prevent evasion.
Custom responses: specify a status code, headers, and body on a Block action to return a custom response, and with Allow or Count you can insert custom headers into requests forwarded to the origin.
Protected resources
One web ACL can be associated with multiple resources of the same scope, but each resource can have only one web ACL. Create web ACLs for CloudFront in the global scope, and all others in the same Region as the resource.
Requests are inspected at edge locations, so attack traffic never reaches the origin. The CloudFront body inspection limit is 16 KB by default and can be raised to 64 KB.
CloudFront distributionAmplify appscope: CLOUDFRONTProtects Regional entry points directly. The body inspection limit is fixed at 8 KB for ALB and AppSync; for API Gateway REST APIs it is 16 KB by default and can be increased.
Application Load BalancerAPI Gateway REST APIAppSync GraphQL APIApply the same rules in front of user pool sign-in endpoints, containerized web services, zero trust application access, and agent tool gateways.
Cognito user poolApp Runner serviceVerified Access instanceBedrock AgentCore GatewayYou can't associate a web ACL directly with an NLB, an API Gateway HTTP API, or an EC2 Elastic IP. Protect such entry points by placing CloudFront in front, or with Shield Advanced and Network Firewall.
Where it fits
They work at different layers and inspect different things, so they complement rather than replace each other.
| Service | Layer | Inspects | Where it attaches |
|---|---|---|---|
| AWS WAF | L7 HTTP(S) | Headers, URI, query, body, cookies, IP · country, request rate, bot signals | web ACL associated with resources such as CloudFront, ALB, API Gateway |
| AWS Shield | L3 · L4 (+ L7 Advanced) | Volumetric and state-exhaustion DDoS. Advanced mitigates L7 with the Anti-DDoS rule group included in the subscription | Standard is automatic. Advanced on designated protected resources |
| Network Firewall | L3 – L7 flows | 5-tuple, Suricata signatures, TLS SNI · domains, all protocols | Firewall endpoints in the VPC · TGW routing path |
| Security groups · NACLs | L3 · L4 | IP, port, protocol | ENI · subnet |
Reference architecture
Web traffic is inspected first at CloudFront, which has a global web ACL associated. The Regional API Gateway gets a Regional web ACL. Firewall Manager enforces common rule groups across every account in the organization, and logs from each web ACL are collected in one place.
On narrow screens, swipe the diagram sideways.
Getting started
Choose the scope of the resources to protect (CloudFront or Regional) and set the default action. The new console shows it as a protection pack.
Add AWS Managed Rules such as Core rule set and IP reputation, and check WCU usage.
Keep rules in Count, enable logging and CloudWatch metrics, find false positives, and create exceptions.
Switch verified rules to Block first, then add rate-based rules and Bot Control.
Use Firewall Manager policies to apply common rule groups automatically to all accounts and new resources.
Pricing
You pay for what you use. The basics are monthly charges per web ACL and per rule, plus the number of requests processed; enabling intelligent threat mitigation features and extended options adds charges.
| Component | Billed by | Notes |
|---|---|---|
| web ACL | Monthly fee per web ACL | Prorated by the hours in use |
| Rules | Monthly fee per rule · rule group in a web ACL | Each managed rule group counts as one rule |
| Requests | Per 1 million requests processed | Applies to every request the web ACL inspects |
| WCU · extended body inspection | WCUs above 1,500 · body inspection beyond 16 KB | Additional WCUs are priced in tiers. If you raise the body limit, extra charges apply only to requests larger than 16 KB |
| Bot Control · Fraud Control · DDoS | Monthly subscription + requests · attempts | Bot Control is priced per Common · Targeted level (with a free request tier), ATP by login attempts, and ACFP by account creation attempts. The Anti-DDoS rule group is also charged separately |
| CAPTCHA · Challenge | Attempts · responses | Charged for CAPTCHA puzzles presented and Challenge responses |
| Related charges | Billed by other services | AWS Marketplace rule group subscriptions, Firewall Manager policies, log destinations (S3 · Firehose, and CloudWatch Logs beyond 500 MB per 1 million requests) |
For resources protected by Shield Advanced, standard AWS WAF charges are included in the subscription (excluding Bot Control, Fraud Control, CAPTCHA, and similar). For CloudFront distributions you can also choose flat-rate pricing plans (launched November 2025) that include AWS WAF and DDoS protection in a monthly fee. Prices are subject to change; check the AWS WAF pricing page.
Next step
Bring a summary of your internet-facing entry points, login and sign-up paths, share of bot traffic, and account structure, and we'll review the rule configuration and the Count → Block transition plan together.