DEV Community

atymic
atymic

Posted on • Originally published at atymic.dev

Editing DNS records for ZEIT Now

ZEIT Now is awesome, but one of the features that's missing is a GUI interface to edit and configure DNS records. It's actually
not even clear this is possible in the dashboard, but luckily there's a set of commands you can use with the CLI.

First off, if you haven't already install and authenticated in the now cli, you'll want to do that:

npm install -g now && now # Will prompt to login

Once you're logged in, you can use the commands in the now dns namespace.

Adding Records

now dns add <domain> <name> <record type> <value> [mx_priority]
  • <domain> is the address owned by the user and previously registered withzeit.world by using the commands now domain add zeit.rocks or now alias
  • <name> is the subdomain that will be prefixed to <domain> (@ as a <name> refers to the domain without any prefix)
  • <record type> contains one of the supported record types shown above
  • <value> indicates the target of the record (like an IP address or a hostname)
  • [mx_priority] sets the priority of a certain MX record and can therefore only be used in conjunction with this record type

Examples

Here's a few examples of commands that might be helpful.

Add a record for a subdomain

  $ now dns add <DOMAIN> <SUBDOMAIN> <A | AAAA | ALIAS | CNAME | TXT>  <VALUE>
  $ now dns add zeit.rocks api A 198.51.100.100

Add a MX record (@ as a name refers to the domain)

  $ now dns add <DOMAIN> '@' MX <RECORD VALUE> <PRIORITY>
  $ now dns add domain.com '@' MX mx1.improvmx.com 10 

Add a SRV record

  $ now dns add <DOMAIN> <NAME> SRV <PRIORITY> <WEIGHT> <PORT> <TARGET>
  $ now dns add zeit.rocks '@' SRV 10 0 389 zeit.party

Remove a MX record

  $ now dns ls # Show the records, and copy the ID you wish to remove
$ now dns rm rec_92bd1b1e4311ffd93e4a2cae # ID from previous step




API

If you're building a tool that integrates directly with Zeit Now, you could also manage the DNS records directly through the
API. You can find the endpoint documentation here.

Top comments (0)