You've successfully subscribed to Nicholas Workshop
Great! Next, complete checkout for full access to Nicholas Workshop
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Dynamic DNS on GoDaddy

Nicholas Wong
Nicholas Wong

GoDaddy doesn't support DDNS out of the box. Luckily it provides APIs to control the DNS fields, so you can dynamically update it by yourself, with some tools.

Create GoDaddy API keys

Go to this page and generate a production key.
https://developer.godaddy.com/keys

Install tool godaddy-dns

This tool is useful and provide CLI to control GoDaddy with command lines.
https://lmammino.github.io/godaddy-dns/

npm install --global godaddy-dns

Config settings

Create a file ~/.godaddy-dns.json and put in the following things, with your own config.

{
  "apiKey": "",
  "secret": "",
  "domain": "example.com",
  "records": [
    {"type": "A", "name": "mysubdomain", "ttl": 600},
    {"domain":"my-other-domain.com", "type": "A", "name": "subdomain2", "ttl": 600} //overrides main domain name (example.com)
  ]
}

Set up cron job

Run this to edit cron job list

crontab -e

Then add this to the end of the list, it's basically saying to run every 5 minutes.

*/5 * * * * godaddy-dns > /var/log/godaddy-dns.log 2>&1
Network Computing

Nicholas Wong

Fullstack software engineer with strong background in computer science and extensive experience in software engineering and architecture. Studied in NYU, worked in Yahoo, Rakuten and Manulife.