nodemethod
SecurityIntermediate

Edge protection: WAF, rate limits and DDoS

Stop volumetric attacks, abusive clients and common exploits before they reach your origin.

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.

EDGEdroppedclean trafficUSRLegitimate users!Botnet400k req/sSECDDoS protectionL3/L4 scrubbingSECWAFmanaged rules + customSECRate limitsper IP, per tokenLBOriginedge traffic only
traffictunnel / replicationblocked

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

  1. Network-layer floods are absorbed by the provider's DDoS service before they reach your resources.
  2. The WAF evaluates each HTTP request against managed rule sets (SQL injection, XSS, known bad inputs) and your own rules.
  3. Rate-based rules limit requests per IP or per API key, with tighter limits on login and password reset.
  4. 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

SignalWhy it matters
Blocked versus allowed requests by ruleA sudden rise in one rule is either an attack or a false positive after a release.
Requests per second by client and pathCredential stuffing looks like many IPs each making a few login attempts.
Origin requests not from the edgeShould be zero.
Login failure ratioRising 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.

Checklist

0 of 5 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open