STK-59Recommended Free tier
Use a managed DNS and CDN that exports your zone
Host DNS and the CDN with a managed provider that exports the zone as a standard zone file, such as Cloudflare.
Review by
2027-04-30
How to do it
A managed service has no version to test, so judge it by the five tests and the exit test. Open source DNS servers exist, but no open source project gives you a worldwide network. A managed service is the realistic choice here. Cloudflare launched on 27 September 2010 and has a free plan for DNS and CDN. It is used by 24.6% of respondents in the Stack Overflow Developer Survey 2026. Its API exports every DNS record as a zone file, so you can move to any other DNS host. A CDN in front of your server is removed by pointing DNS back at the origin. Keep the records in code as Keep DNS records in code says. Choose something else when all your servers live in one cloud. Then that cloud's own DNS and CDN keep everything in one account.
Examples
Shell example
curl -s -H "Authorization: Bearer $CF_API_TOKEN" \
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/export" > example.com.zone
Terraform example
resource "cloudflare_dns_record" "www" {
zone_id = var.zone_id
name = "www.example.com"
type = "CNAME"
content = "example.com"
proxied = true
ttl = 1
}
How to check
A zone export through the provider's API returns every record, run in the last 12 months. The origin server answers on its own address with the CDN switched off.
Sources
Related rules
- INF-71 Let only your edge network reach the origin in Infrastructure and environments
- INF-35 Keep DNS records in code in Infrastructure and environments
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/managed-dns-and-cdn">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.