Edge: CloudFront, WAF, Shield
CDN caching behaviors, origin access control, WAF rule groups, DDoS tiers. The first layer a customer request touches — and the first line of defense.
The mental model
The edge is the outermost ring of your infrastructure — the layer a customer's request touches first, thousands of kilometres before it reaches your servers. Think of it as the network of neighbourhood branches a bank runs so customers do not all have to travel to head office. Most transactions (checking a balance, withdrawing cash) happen at the local branch instantly; only the unusual ones (a large loan) go to head office. CloudFront is that branch network for your content: over 600 points of presence worldwide that cache your responses close to users, so a request from Mumbai is answered in Mumbai, not fetched from a server in Virginia.
But the outermost ring is also the first line of defence, and that is the second half of this topic. The same branches that serve customers fast are where you post the security guard. WAF (Web Application Firewall) is the guard checking each visitor against a rulebook — blocking SQL injection, filtering bad bots, rate-limiting abusers — at the door, before they reach the vault. Shield is the protection against a mob trying to overwhelm the branch by sheer numbers — a DDoS attack — absorbing the flood at the edge where there is capacity, rather than letting it reach and crush your origin.
Why this exists and why interviewers care: the edge is where performance and security meet, and both are cheaper and more effective the further out you push them. Caching a response at the edge is faster *and* takes load off your origin *and* reduces egress cost. Blocking an attack at the edge stops it before it consumes your compute *and* protects your database *and* costs less than filtering it deeper in. The core insight is that work you can do at the edge is work your origin never has to do — every cache hit is a request your servers never see, and every blocked attack is a packet your application never processes. A senior engineer designs so the origin does as little as possible.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision