Scriptable GeoDNS: Leaving AWS for Bunny
Vincent Bernat migrated his blog's geo-aware DNS and CDN from AWS to Bunny.net, cutting monthly costs from five dollars to one by using scriptable JavaScript routing.
read it The post offers a deeply practical architectural walkthrough of cutting AWS costs with scriptable DNS, complete with custom JavaScript routing logic and edge-case mitigations.
summary
Vincent Bernat details his migration from AWS Route 53 and CloudFront to Bunny.net to optimize costs and latency for his globally distributed blog running on seven NixOS virtual machines. He leverages Bunny's scriptable DNS feature to execute custom JavaScript that routes users to the closest active servers using geographic distance calculations. To handle ACME challenges without AWS, he combines a local Hickory DNS instance with deSEC for DNSSEC support. The migration successfully dropped his monthly infrastructure bill from five dollars to one dollar while maintaining high performance.
key points
- Bunny's scriptable DNS runs custom JavaScript per query, allowing developers to implement tailored geographic and proximity routing logic using coordinates.
- A hybrid routing strategy balances latency and availability by returning two servers for close proximity or a single server with a short TTL for distant outliers.
- Hickory DNS and deSEC serve as a lightweight, memory-safe alternative for handling DNS-01 ACME challenges and DNSSEC without relying on cloud provider managed zones.
who should read it
Infrastructure engineers and self-hosters looking to optimize multi-region deployments and reduce cloud networking costs.
discussion warm
consensus
Commenters enthusiastically praise Bunny's scriptable DNS offering and highlight how traditional cloud providers overcharge massively for geolocation queries compared to alternative providers.
The "cloud provider rates" for this are a bit crazy. It's great bunny.net is offering a (more flexible!) product basically for free.
The NTP Pool does ~1m dns queries a second on the hourly peak with a small-ish (old) Go program (called `geodns`) running on a bunch of mostly small VMs around the world. The average is much less, but paying $0.70/million for ~11 billion queries a day would be a lot of money for a "random volunteers on the internet" project at "cloud provider rates".
It puts cloud provider pricing into perspective by comparing Route 53 rates against the immense scale of the NTP Pool.
Generated by an LLM from the article and thread. Check the sources before relying on it.