Absorb volumetric attacks
Traffic far above capacity from thousands of sources.
Say it like this
Attack traffic must be absorbed before it reaches anything I pay to scale, so I put the whole system behind a CDN with network-level scrubbing, rate limit at the edge by IP and key, and shed load at the service with a priority order.
Basic solution
Front everything with a CDN / scrubbing network, rate limit per IP and per key, and shed load at the edge.
Absorb at the edge, verify in the middle, shed at the origin
Anycast lands attack traffic on the provider network where floods are dropped and cacheable responses are served; what remains is rate limited and scored before reaching an origin that accepts traffic only from the provider.
How it works
- Every public hostname resolves to the CDN or scrubbing provider through anycast, so attack traffic lands on a network with terabits of capacity spread across hundreds of sites rather than on your load balancer. Your own IP space is not advertised directly at all.
- Network-layer floods (SYN floods, UDP floods, amplification attacks) are recognised and dropped at that provider's edge automatically. They never reach your addresses because nothing routes there from the public internet.
- HTTP-layer traffic, which looks like real requests, passes through edge rules: per-IP and per-network (ASN) rate limits, challenge pages that a browser passes and a script does not, bot scoring based on the TLS fingerprint and request behaviour, and geographic or path rules you can tighten during an incident.
- The origin accepts connections only from the provider's published IP ranges, or through a private tunnel the origin opens outward to the provider. Either way an attacker who discovers the origin address cannot bypass the edge by hitting it directly.
- Inside, services shed load in a fixed order. Admission control rejects requests beyond capacity with a 503, priority rules keep logged-in and paying traffic ahead of anonymous traffic, and caches serve static and cacheable responses without the origin being touched.
Volumetric vs application-layer
- Volumetric attacks are about bandwidth and packets per second, and they are solved by capacity you rent from a provider. Application-layer attacks look like real requests, and they are solved by telling users from bots and by making every request cheap to serve.
Worked example
URL shortener redirects
- Normal load: 4,000 redirects/s, 40K at peak. An attack of 2M requests/s against a few popular aliases is 500× normal.
- Edge absorption: the redirect response is a 302 with a Location header, cacheable at the edge for the alias's TTL. With a 60-second edge cache, 2M/s against 50 aliases becomes 50 origin requests per minute. The attack is served entirely from cache.
- Bandwidth: 2M/s × 500 B = 1 GB/s, trivial for a global CDN, fatal for a single 10 Gbps uplink without one.
- Random-alias attack (uncacheable 404s): per-IP limits of 100 requests/s drop a botnet of 10,000 IPs to at most 1M/s before challenges; bot scoring and a JavaScript challenge cut that by another two orders of magnitude. The origin is sized for 40K/s and sheds the remainder with 429s costing under 0.1 ms each.
- Create API: 40 writes/s normal, each costing a database insert. Per-key limits (100/min free tier) and a global admission limit of 2,000 creates/s cap the damage; anything above is rejected at the gateway before touching the database.
- Cost note: an unprotected origin autoscaling to absorb 2M/s would need ~500 instances and a database it cannot have; the edge cache costs nothing extra.
Variants and when each wins
Always-on CDN with built-in scrubbing (Cloudflare, Akamai, AWS Shield Advanced + CloudFront)
- All traffic flows through the provider all the time, and protection engages on its own. It wins as the default for anything public because there is nothing to switch on during an attack.
On-demand scrubbing (BGP diversion)
- Traffic is rerouted to a scrubbing centre only when an attack is detected. It wins on steady-state cost and latency for organisations with their own IP space; it takes minutes to engage and is complex to operate.
Rate limiting at your own gateway only
- Your gateway counts requests per client and rejects abusers. It is necessary against individual abusive clients, and not sufficient on its own, because a volumetric attack saturates the network link before the gateway sees a packet.
Anycast your own edge
- You run many small points of presence announcing the same prefix. It wins for spreading load geographically at very large scale; it requires network engineering that most teams should rent instead.
Recommendation: always-on CDN with scrubbing for everything public, origin locked to the provider, your own per-key limits and admission control behind it.
Failure modes
Origin reachable directly
- The attack bypasses the CDN and lands on the load balancer. It happens because the origin IP is public and discoverable through old DNS records, certificate transparency logs or email headers. Allow only the provider's IP ranges or a private tunnel, and rotate the origin IP after enabling protection.
Uncacheable hot path
- The edge forwards every request to the origin, so the CDN absorbs nothing. It happens because responses carry no-store or vary on cookies, headers that were set for safety. Make the anonymous read path cacheable with short TTLs, and strip irrelevant cookies at the edge.
Rate limits that block real users
- An entire office or a mobile carrier behind one shared address gets blocked. It happens because per-IP limits were set too low for networks where thousands of people share an IP. Combine the IP with other signals (API key, session, fingerprint), serve a challenge before blocking, and allow-list known partners.
Expensive request on an open endpoint
- A few thousand requests per second to a search or report endpoint take the database down. It happens because the cost of serving each request was never considered. Require authentication before expensive work, weight per-endpoint limits by cost, and cache the results.
Autoscaling as the defence
- The attack ends and the bill arrives. It happens because the fleet scaled up to serve attack traffic. Cap autoscaling, shed at the edge, and treat capacity for attacks as something you rent from a provider rather than something you buy in instances.
Interviewer follow-ups
Answer out loud before you open each one.
How is an application-layer attack different from a volumetric one, and what changes in the defence?
Volumetric attacks exhaust bandwidth or packet processing with traffic that is obviously junk; the defence is capacity and dropping at the network edge. Application-layer attacks send valid-looking requests that are expensive to serve; the defence is distinguishing bots from users (fingerprints, challenges, behaviour) and making requests cheap or cacheable.
What do you shed first when load exceeds capacity?
Unauthenticated and retried traffic first, then bulk and background work, then anonymous reads, keeping authenticated writes and paying customers last. The order is decided ahead of time and encoded in admission control, because during an incident there is no time to decide.
How do you stop attackers bypassing the CDN?
The origin must not be reachable from the internet: firewall rules allowing only the provider ranges, or an outbound tunnel from the origin to the provider so there is no inbound path at all. Also rotate the origin IP when enabling protection, since old records and certificate transparency logs reveal the previous one.
Can rate limiting alone protect the shortener?
No. It handles abusive individual clients, but a volumetric attack fills the network link before the limiter sees anything, and a distributed application-layer attack stays under any per-IP limit. Rate limiting is one layer behind edge absorption, caching and admission control.
Connections
The same parts on other clouds
The diagrams above name AWS services as one concrete example. Every part has a close equivalent elsewhere. In an interview, name the role first, such as “a managed Redis cache”, then the product you would pick.
| AWS | Used here as | Google Cloud | Microsoft Azure | Open source and others |
|---|---|---|---|---|
| Amazon CloudFront | CDN / scrubbing edge, Edge cache | Cloud CDN, Media CDN | Azure Front Door | Cloudflare, Fastly, Akamai |
| AWS WAF | Edge rules | Cloud Armor | Azure Web Application Firewall | Cloudflare WAF, ModSecurity |
| Amazon API Gateway | Origin gateway | API Gateway, Apigee | API Management | Kong, Tyk |
| Amazon EC2 Auto Scaling | Redirect service | Compute Engine managed instance groups | Virtual Machine Scale Sets | Kubernetes Deployment with a HorizontalPodAutoscaler, Nomad |