DNS as a datastore: the Route53 trick

Route53, AWS's DNS management service, is not a database — but that hasn't stopped people from treating it like one. Writing for Better Programming, Nicholas Martin documented the technique, which was originally demonstrated by Corey Quinn.

The reasoning behind it is that DNS configuration already behaves like a very rudimentary NoSQL database: you can view and modify it at any time through your domain provider's website, and each record maps to a row in a table. The verification pattern makes this concrete — plenty of services use DNS TXT records to confirm domain ownership. Add or modify a TXT record to hold a key/value pair, and the service queries it back.

Many services use DNS TXT records to verify domain ownership. You would essentially add or modify a TXT record to store a key/value pair, which the service will then query.

The appeal is speed and price. Route53 is described as super fast, and the cost comes to $0.50 plus $0.40 per million queries. Libraries exist to make it easier: ten34 and diggydb.

Caveats come with the territory, though. There is no auth to speak of, and there's the worry that Amazon might take a dim view of the practice and cut it off.

  • Records behave like rows; TXT records hold key/value pairs
  • Pricing: $0.50 + $0.40 per million queries
  • Tooling: ten34, diggydb