Streaming platform S2 has replaced part of its managed DNS workflow with a custom authoritative server after deciding that provider API limits were incompatible with its plan to offer customers an unlimited number of top-level containers.
S2 calls those containers basins. Each basin receives a subdomain under b.s2.dev and a CNAME record that routes clients to the correct cell in the company's architecture. The company said customers were working around an earlier limit of 100 basins per account, prompting it to redesign the system around effectively unlimited records and immediate availability.
The existing Amazon Route 53 setup could hold the records, but S2 said the update API became the bottleneck. The problem became operationally visible when an abusive account rapidly created tens of thousands of basins. DNS changes accumulated for hours while additions and deletions competed for the available update capacity. Batching changes would have increased throughput, but it also risked delaying new names and leaving clients with cached NXDOMAIN responses.
S2's replacement server reads mappings directly from the company's basin database in Google Cloud Spanner. That avoids maintaining a separately synchronized DNS record store and makes the DNS service another client of the same strongly consistent account data. Engineers implemented the server in Go with the miekg/dns library, despite S2 otherwise using Rust extensively, citing more mature Spanner and Google Cloud tooling in Go.
The authoritative service supports A, AAAA, NS, CNAME and SOA queries. S2 said its validation included unit tests, automated RFC compliance checks using Ferret, and smoke tests against live data. It kept ACME DNS-01 certificate challenges in a separate Route 53 zone reached through CNAME delegation, limiting changes to the existing certificate-renewal system.
Directly exposing a database-backed DNS origin created a separate security concern. Random queries for nonexistent names could force repeated database lookups, making NXDOMAIN floods particularly expensive. After assessing in-application defenses, S2 placed Cloudflare DNS Firewall in front of the authoritative servers and restricted origin access to Cloudflare addresses. It also added a test intended to prevent origin IP addresses from leaking through nameserver responses.
For resilience, the company runs the service across two Google Kubernetes Engine clusters in separate regions. The resulting design is not a general argument for every company to operate DNS infrastructure. It addresses S2's specific combination of rapidly created customer namespaces, immediate consistency and a record count not bounded by a product limit. The project illustrates how a managed service can remain part of an architecture even after a team takes control of the layer constrained by its API.


![500px provided description: Anohter Laptop With Cool Free Software Stickers At Guadec [#stickers ,#2015 ,#Tech ,#GNOME ,#FOSS ,#Open Source ,#Free Software ,#GUADEC ,#Confrance]](/media/articles/commons-e039f8ff3448.avif)
