Dynamic DNS on GoDaddy
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