Accelerate content delivery to the edge location and make domain names resolve reliably. This episode covers CDN for static and dynamic content, cloud DNS with latency-based routing, geolocation, and health check failover, plus a comparison of CloudFront, Route 53, Cloud CDN, Cloud DNS, Azure Front Door, and Azure DNS.

In episode 12 we deployed applications with containers and Kubernetes. But a good deployment doesn't mean a good user experience: if all your servers are in Singapore, users in London must travel thousands of network kilometers for every image, file, and script. This is where two complementary network services come in: CDN to shorten the content journey, and cloud DNS to guide domain names to the right destination.
Episode 13 covers why latency is a matter of distance physics, how CDN stores content at edge locations around the world — including dynamic content — and how cloud DNS performs traffic management with latency-based routing, geolocation, and automatic failover based on health checks.
Latency is the time data takes to travel. Light in optical fiber travels at about two-thirds the speed of light in a vacuum — every 1000 kilometers adds about 5 milliseconds per direction, not counting the network equipment at each hop.
| Distance | Round trip |
|---|---|
| Jakarta to Singapore | About 25-40 ms |
| Jakarta to London | About 130-180 ms |
| Jakarta to New York | About 180-250 ms |
A user in London would feel an application is "slow" not because the server is weak, but because every byte must travel tens of thousands of kilometers. The solution isn't strengthening the server — it's bringing the data closer to the user.
A CDN (Content Delivery Network) is a network of cache servers spread across edge locations around the world. When a user in Jakarta requests a file, the CDN directs the request to the nearest edge, not to the origin server in London.
How it works is simple:
| Aspect | Without CDN | With CDN |
|---|---|---|
| File source | Distant origin server | Nearest edge |
| Latency | Depends on physical distance | Consistent and low anywhere |
| Origin load | All requests hit the origin | Only cache misses |
| Resilience | Origin down means everything down | Static files still served from the edge |
Tip
Think of a franchise convenience store. Instead of every buyer in Jakarta, Bandung, and Makassar having to come to one central warehouse in Jakarta (origin), the CDN builds a local convenience store in every city (edge). The best-selling items — images, scripts, videos — are already stacked at the nearest store from the start. The central warehouse is only used for genuinely new items.
CDN isn't only for static files. For dynamic content — HTML that differs per user, authentication results, or APIs — the CDN remains useful through two mechanisms:
Additionally, the CDN becomes the first protection layer against DDoS: thousands of edges absorb attack volume before it reaches the origin. This is also why in episode 14 later, the CDN is described as part of a layered defense.
One of the most common operations is cache invalidation: when new content is deployed, the old files at the edge must be removed so users don't get stale versions. On AWS this is done with aws cloudfront create-invalidation:
aws cloudfront create-invalidation \
--distribution-id E1XYZEXAMPLE \
--paths "/index.html" "/assets/*"This command tells CloudFront that index.html and all files in the assets folder must be considered expired across all edges. On GCP, the same operation is done via Cloud CDN by invalidating the cache on the backend service; on Azure, via Azure Front Door with purge content. Same concept — only names and syntax differ.
Caution
Don't make full invalidation a habit with every deploy. Invalidation is an operation that floods the origin with requests and consumes time. The better practice is cache busting: naming files with a hash of their content, e.g. app.a1b2c3.js. When content changes, the file name changes, and browsers and the CDN treat it as a new file — with no invalidation needed at all.
Now that content is close to users, the next question: how does the domain toko-kalian.id find the right server? DNS (Domain Name System) is the internet's directory that translates domain names into IP addresses.
| Component | Function |
|---|---|
| Domain | The name users type |
| A and AAAA records | Map the domain to IPv4 and IPv6 |
| CNAME record | Alias a domain to another domain |
| TTL | How long a resolver may cache the answer |
Cloud DNS means the domain name is managed by the provider — AWS Route 53, GCP Cloud DNS, Azure Azure DNS — with global reach and a high SLA. Its added value isn't just name resolution, but traffic management: smart decisions about which IP to answer with, based on real-time conditions.
Important
The most critical capability is health check DNS failover. Imagine a shop with two doors: the main door in Jakarta and a backup door in Bandung. If the main door breaks and no one tells visitors, everyone still comes to the broken door. A health check is the staff member who walks around inspecting the doors every few minutes — the moment the main door breaks, they put up a sign pointing to the backup door before visitors arrive.
To verify DNS answers, you can use dig or nslookup directly from the terminal. Here's an example of tracing the address answered for a domain:
dig +short toko-kalian.id
54.230.200.10The result is the IP address answered by DNS. If you run dig +short from two different locations on a latency-based routing configuration, the results can differ — that's proof the DNS is doing traffic management. To see full details including TTL and authoritative nameservers, run dig toko-kalian.id ANY or nslookup toko-kalian.id — both show the same report, just in different formats.
To add a new record in Route 53, AWS provides aws route53 change-resource-record-sets — a command that sends DNS changes in JSON format:
aws route53 change-resource-record-sets \
--hosted-zone-id Z1ABC2DEF3G4H \
--change-batch '{
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "api.toko-kalian.id.",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{ "Value": "203.0.113.10" }
]
}
}
]
}'Notice the striking TTL difference between CDN and DNS practice: DNS TTL determines how long a resolver may keep an answer. A short TTL (e.g. 300 seconds) means DNS changes — like an IP move due to failover — spread quickly, while a long TTL saves DNS queries.
| Need | AWS | GCP | Azure |
|---|---|---|---|
| CDN | CloudFront | Cloud CDN | Azure Front Door |
| DNS | Route 53 | Cloud DNS | Azure DNS |
| Smart routing | Route 53 policies | Cloud DNS routing (geo, latency) | Traffic Manager |
All three clouds offer equally complete CDN and DNS pairs. Often both are used together: the CDN needs DNS to direct users to the right edge, and smart DNS needs data about user location — they complement each other for one goal: making the application feel local to every user in the world.
In this episode 13 you understood the two layers that make an application feel fast and reliable globally: CDN, which brings static and dynamic content closer to edge locations so users anywhere are served by the nearest server, and cloud DNS with traffic management — latency-based routing, geolocation, and health check failover — which guides domain names to the best destination. You also practiced cache invalidation via aws cloudfront create-invalidation, reading dig output, and adding records with aws route53 change-resource-record-sets.
The keys to take away:
Your application is now fast and easy to reach — and precisely because of that, it's more worth attacking. The more popular a service is, the more attractive it becomes to attackers. Episode 14 will build defense on top of the networking foundation you've already mastered: Cloud Security, Firewall & Web Application Firewall (WAF) — layered defense that protects the application you've built so far.