Public endpoints need protection at the edge, where capacity is largest. Provider DDoS protection absorbs network-layer floods. A web application firewall blocks common exploit patterns and applies rate limits per client. Bot management and allow-lists handle the rest. The origin only accepts traffic that has passed through this layer.
- Detect
- Analyze
- Resolve
When to use it
- Any internet-facing web application or API
- Login and checkout endpoints targeted by credential stuffing
- Services with a history of scraping or abuse
When to avoid it
- Turning on every managed rule in block mode on day one: start in count mode and tune
How traffic flows
- Network-layer floods are absorbed by the provider's DDoS service before they reach your resources.
- The WAF evaluates each HTTP request against managed rule sets (SQL injection, XSS, known bad inputs) and your own rules.
- Rate-based rules limit requests per IP or per API key, with tighter limits on login and password reset.
- The origin rejects requests that did not come through the edge.
Configuration examples
resource "aws_wafv2_web_acl" "edge" {
name = "edge"
scope = "CLOUDFRONT"
default_action { allow {} }
rule {
name = "common"
priority = 10
override_action { none {} }
statement {
managed_rule_group_statement {
vendor_name = "AWS"
name = "AWSManagedRulesCommonRuleSet"
}
}
visibility_config { metric_name = "common" cloudwatch_metrics_enabled = true sampled_requests_enabled = true }
}
rule {
name = "login-rate"
priority = 20
action { block {} }
statement {
rate_based_statement {
limit = 100 # per 5 minutes per IP
aggregate_key_type = "IP"
scope_down_statement {
byte_match_statement {
search_string = "/login"
positional_constraint = "STARTS_WITH"
field_to_match { uri_path {} }
text_transformation { priority = 0 type = "LOWERCASE" }
}
}
}
}
visibility_config { metric_name = "login-rate" cloudwatch_metrics_enabled = true sampled_requests_enabled = true }
}
visibility_config { metric_name = "edge" cloudwatch_metrics_enabled = true sampled_requests_enabled = true }
}Examples are starting points. Review provider limits, names and versions for your environment before applying.
What to monitor
| Signal | Why it matters |
|---|---|
| Blocked versus allowed requests by rule | A sudden rise in one rule is either an attack or a false positive after a release. |
| Requests per second by client and path | Credential stuffing looks like many IPs each making a few login attempts. |
| Origin requests not from the edge | Should be zero. |
| Login failure ratio | Rising failures with steady traffic point to credential stuffing. |
Common failure modes
False positives block real customers
A new form field trips an injection rule and checkouts fail.
Lens links the rise in blocks to the release and shows the matching rule and sample requests.
Distributed low-and-slow attacks
Each IP stays under the rate limit.
Lens groups requests by fingerprint and behaviour, not just IP, and recommends a rule.