DNS Routing Policies: Directing Traffic with Intention
DNS routing policies are a control plane for your domain, directing users based on location, latency, or server health. Use them for disaster recovery (failover) or canary releases (weighted). The footgun: confusing geolocation with latency-based routing.
WHY IT EXISTS Simple DNS just maps a name to an IP address. But modern systems need to handle global users, ensure high availability, and perform controlled rollouts. Routing policies provide the intelligence layer on top of basic DNS to solve these complex traffic management problems at the edge of the network.
THE MENTAL MODEL Think of DNS routing policies as a smart traffic cop for your application's domain name. Instead of just pointing all cars to one fixed address, this cop can check a driver's origin (geolocation), ask how bad the traffic is on various routes (latency), see which destinations are open for business (health checks), or send a small percentage of cars down a new road to test it (weighted).
HOW IT WORKS When a DNS query hits a managed DNS service like AWS Route 53, it doesn't just return a static record. It evaluates a pre-configured policy to decide which IP address to return. Common policies include: Weighted, which distributes traffic in specified ratios (e.g., 90% to a stable version, 10% to a new one); Latency-based, which responds with the IP of the server in the region with the lowest network latency for the user; Failover, which provides a primary and secondary IP, automatically switching to the secondary if the primary fails health checks; and Geolocation, which routes users to endpoints based on their geographic location (e.g., users from Europe go to a European server).
WHEN TO USE IT Use routing policies for critical system-level tasks. Implement disaster recovery with a failover policy. Reduce latency for a global user base with latency or geolocation policies. Perform A/B testing or canary deployments using a weighted policy. Distribute load across multiple regions to improve availability and performance.
WHEN NOT TO USE IT For simple applications with a single server in one location, a basic "simple routing" policy (a standard A record) is sufficient and less complex. Over-engineering with complex policies when not needed adds configuration overhead and potential for misconfiguration. Also, remember that DNS changes can take time to propagate due to caching, so it's not a tool for instantaneous traffic shifts, though low TTLs (Time to Live) help mitigate this.
ONE CANONICAL EXAMPLE A company is launching a new feature. To test it safely, they use a weighted routing policy. They configure their domain to send 95% of traffic to the old, stable application servers (the "blue" environment) and 5% of traffic to the new servers with the feature (the "green" environment). This allows them to monitor the new feature's performance and error rates on a small subset of users before rolling it out to everyone.
Read the original → docs.aws.amazon.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.