Interview Prep/DevOps Fundamentals/Networking basics for DevOps

What is a CDN, and how does it help applications?

BeginnerConceptNetworking basics for DevOps
Answer

In one line: A CDN (Content Delivery Network) is a global network of servers that caches your content close to users, so pages load faster, your origin servers get less load, and you get extra protection against attacks.

How it works:

  1. You put the CDN in front of your website or storage (the "origin"), usually by pointing DNS at the CDN.
  2. A user in Chennai requests an image. The CDN routes them to the nearest edge location.
  3. If the edge has the file cached (cache hit), it returns it immediately.
  4. If not (cache miss), the edge fetches it from the origin, returns it and caches it for next time, based on cache rules and headers (Cache-Control).

Benefits:

  • Speed — less distance means lower latency.
  • Lower origin load and cost — most static requests never reach your servers.
  • Scalability — handles traffic spikes for cached content.
  • Security — DDoS protection, Web Application Firewall (WAF), bot protection, TLS at the edge.
  • Availability — can serve cached content even if the origin is briefly down (with the right settings).

What to cache:

  • Static assets — images, CSS, JavaScript, fonts, videos: long cache times, with versioned file names (app.3f9c2.js) so new deployments don't get stale files.
  • HTML and API responses — short cache times or none, depending on how dynamic they are.

Common CDNs: Cloudflare, AWS CloudFront, Azure Front Door, Akamai, Fastly, Google Cloud CDN.

DevOps tasks with CDNs:

  • Configure cache rules and headers.
  • Invalidate/purge cache after deployments when needed (aws cloudfront create-invalidation --paths "/index.html").
  • Manage TLS certificates and WAF rules.
  • Manage the CDN configuration as code (Terraform).

Example: a static React site lives in S3 behind CloudFront. Built assets have hashed names and a one-year cache; index.html has a short cache and is invalidated on each deployment.

Tip for interviews: mention cache invalidation and versioned asset names — that's where most real CDN issues come from.

All DevOps Fundamentals questions

More on Networking basics for DevOps