Design doc · 07 of 12

Edge defence: survive a DDoS

Layered protection at the edge: DDoS scrubbing, a WAF and bot management in front of your system.

Template
Edge defence: survive a DDoS
Level
Intermediate
Reading time
12 min
Topics
DDoSWAFBot managementDefence in depthFalse positives

The challenge in the lab 1,500 req/s of real users. At 15 s a 20,000 req/s flood hits for 15 s. Nothing stands in front of the load balancer. Keep success ≥ 98%, block ≥ 95% of the attack and keep the database out of it. Add DDoS protection, a WAF and bot management in front.

1Context and scope

A service with a load balancer, an API and a database. Halfway through, a flood of 20,000 requests a second arrives for 15 seconds. Nothing in the design can tell attackers from users, so the flood takes the capacity real users need.

2Goals and non-goals

Goals

  • 1,500 real users a second.
  • Keep success at least 98%, block at least 95% of the attack, and keep attack traffic out of the database.

Non-goals

  • Attacks that use valid accounts (credential stuffing, fraud): authentication and fraud checks handle those.
  • Floods that bypass the edge: lock the origin so it only accepts traffic from the edge.
  • Fixing bugs in the application itself (the WAF only filters known attack patterns).

3Capacity estimate

Back-of-the-envelope numbers from the template. The simulation uses the same ones, so you can check them against a run.

QuantityValueHow
Real users1,500/s
Attack20,000/s for 15 s13× the real traffic
Attack that gets through at 98% blocking400/sstill a quarter of real traffic

4The design

Each component in the template, in the order a request meets it, and why it is there.

  1. DDoS protection

    Absorbs volumetric floods at the network edge, before they reach you.

  2. WAF

    Inspects HTTP requests and blocks known-bad patterns, scraping and credential stuffing.

  3. Bot management

    Scores clients by behaviour and fingerprint to stop automated traffic that looks almost human.

  4. Load balancer, API, Postgres

    The system being protected. It was sized for users, not for attackers.

5Key concepts

Defence in depth

Each layer stops a different kind of attack: floods at the edge, malicious requests at the WAF, automation at the bot manager. No single filter covers all of them.

Block rates are never 100%

At 98% blocking, 2% of a 20,000 req/s flood still arrives: 400 req/s. Design so what leaks through cannot hurt the data layer (rate limits, capacity headroom).

False positives

Every filter blocks some real users. Tight rules stop more attacks and more customers; tune them in log-only mode first and challenge instead of blocking where possible.

Graceful degradation

Keep the service usable even when some attack gets through: shed low-priority work, protect the database, keep core paths fast.

6Alternatives considered

  • Stricter filters block more attack and more real users.
  • Full bot management can cost as much as the rest of the edge.

7Failure modes and fixes

What goes wrong in the simulation, why, and the change that fixes it. Each one shows up as a finding in the lab; ask “what broke?” to see it, and for the fix when you want it.

Real users fail and attack traffic reaches Postgres.

WhyWith no filter in front, the flood competes with users for API slots and database connections.

FixPut DDoS protection, a WAF and bot management in front of the load balancer.

8Try it in the lab

Open the template, then type these into the copilot one at a time. The first few are also offered as buttons when the template opens.

  1. add ddos protection

    The flood is stopped at the edge; compare success before and after.

  2. add a waf

    Covers credential stuffing and scraping.

  3. add bot management

    Covers automated bots.

  4. stress test

    Runs a DDoS, bot and credential-stuffing drill against your defences.

Open “Edge defence: survive a DDoS” in the lab

9Check yourself

  1. Why is a single WAF not enough against a volumetric DDoS?
  2. If 1% of a 50,000 req/s attack gets through, how does that compare with 1,500 real users?
  3. How would you tune a filter to keep false positives low?

10Further reading