Blog What We Do Support Community
Developers
Login Sign up

Managing DNS Records For The People With Cloudflare Apps

by Michael Pinter.

DNS records are hard.  Many people, even the technically competent, don’t understand more than the basics.

DNS records are hard

I'll speak for myself — as someone who always learned just enough about DNS to get it working, then immediately forgot everything until the next time it broke. It was a vicious cycle until I convinced myself to learn it in depth.  Meanwhile, non-technical folks wisely avoid meddling in such dangerous affairs all together.

Surely, there must be a better way (this is a blog post after all).

Every day, thousands of Cloudflare users add DNS records to their Internet properties to configure awesome tools like G Suite, Shopify, Wordpress, Ghost, and thousands of others.  A new Cloudflare Apps feature allows apps to automatically set up and manage configurable DNS records on more than 12 million registered domains on the Cloudflare network. In short, Cloudflare Apps are here to alleviate the Internet’s collective DNS woes.

Gone are the days of tribulating over whether it’s A or CNAME you should set.  Gone are the days of puzzling between A and AAAA records while wondering what the heck happened to AA and AAA records?  Unload your DNS dysphoria onto highly trained developers experienced at explicating these burdensome questions today!

Did you know?

Are you a highly trained developer?  Cloudflare now provides the tools to build robust, powerful apps that automate DNS record management saving countless developer hours that are currently spent fiddling with DNS.  Instead of manually configuring records to integrate with your solution provider, build a Cloudflare App that does it for you and for everyone else on the Internet.

Pointless DNS is a demo app that showcases the new DNS feature by installing a (pointless) TXT record on any root or subdomain of your choice.  The TXT record is configured and managed by the Pointless DNS app.  Go ahead and install it to see automated DNS record management with Cloudflare Apps.

The TXT record name was set to "blog" during installation

After installation, head over to your DNS dashboard and you'll see the app doing its thing.  If you really want to, you can uninstall it from your Installed Apps page.

Managed Cloudflare DNS record
Pointless DNS automatically manages its TXT record on my blog subdomain

To start building your own DNS app, download create-cloudflare-app and open it in your preferred text editor.  Below, I’ll explain how Pointless DNS manages its configurable TXT record.

In the install.json file, you’ll find a dns field that looks like this:

# install.json

"dns": [{
    "type": "TXT",
    "content": "Managed TXT Record",
    "name": "Created by create-cloudflare-app",
    "ttl": 120
  }]

This says a TXT record will be set up and managed on the app installer's site, which can only be modified or deleted through the app’s configuration page.  Apps can create or modify any type of Cloudflare DNS record available in Cloudflare's DNS API.

Now let's add in some configuration. Add an install option and point it at your record — options.subdomain will be set to the installer's desire.

# install.json

{
  "options": {
    "properties": {
      "subdomain": {
        "order": 1,
        "type": "string",
        "title": "TXT Record Subdomain",
        "description": "The subdomain of your DNS record",
        "placeholder": "*Required - e.g. [your_domain].com",
        "required": true
      }
    }
  },
  "dns": [{
    "type": "TXT",
    "name": "{{options.subdomain}}",
    "content": "{{options.subdomain}} was set"
  }]
}

That's all there is to it.  Check out the Cloudflare Apps docs to learn more about about building DNS apps.  For additional inspiration, consider Mailchannels — a powerful email security solution that manages DNS records to fight off pesky spammers and phishermen.

Woof!

DNS records used to be hard, but a new breed of Cloudflare Apps makes them easy.  Cloudflare Apps-based automated DNS configuration gives developers the opportunity to be the hero people want and the hero they need.

NOTE: This post was updated 5 hours after initial publication to include additional, relevant details.

comments powered by Disqus