We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Mitigating DDoS

Effective DDoS defense is layered. Each layer absorbs or drops traffic before it reaches the next:

  • CDN – serves cached responses and can absorb traffic before it reaches your servers
  • WAF (Web Application Firewall) – blocks known bad patterns, malformed requests, and flagged IPs
  • Load balancer – spreads accepted traffic across healthy application instances and removes unhealthy instances from rotation
  • Rate limiting – slows abusive clients, applied per IP, API key, or user
  • Application – bounds request work, uses timeouts, and sheds load when capacity is exhausted
  • Database – limits connections and expensive queries so the application cannot overwhelm its own storage layer
  • Autoscaling – buys time under unexpected load, but doesn't solve abuse on its own

Click to play video

Because DDoS is a problem of scale and volume, most production systems sit behind a service like Cloudflare, AWS Shield, Azure DDoS Protection, or Google Cloud Armor. They can filter traffic before it consumes your origin's bandwidth.

Even with edge protection, your app still needs rate limits, resource limits, timeouts, and load shedding for traffic that gets through. And sometimes a traffic spike is legitimate – and a good thing!

Oh no, ten thousand people are trying to send me Stripe payments at the same time... /s