Skip to content
Update Digital Ocean DNS to a dynamic WAN IP with a single CURL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Digital Ocean DNS Update

This script allows remote devices to update DNS A records without needing to give them complete access to the Digital Ocean account with API keys on the client side.

To set up, rename info-example.json to info.json, and add keys and domains.

Example Server Setup

Given the details in the example json file, a call to the URL below would update and to the public IP address of the client requesting the URL using the API keys listed in the top of the file, and associated with the entry.


Additionally, if you want to specify an IP explicitly, you can set the ip attribute in the url. For example:


Example Client Setup

Because it's simply a web request, a curl command in your cron file can be all you need. For example, the following command would update the IP every 5 minutes. Or, you could pipe the output to a log file if you wish.

# Update dynamic ip
*/5 * * * * curl http(s)://[location-of-script]/?statictoken=pick-any-token-you-wish >/dev/null 2>&1

More Advanced Setup

If you have multiple public interfaces, you could parse the output of ifconfig and explicitly specify the IP, to ensure it gets updated correctly, no matter which interface the request goes out. The possibilities are endless.


  • Read current record value from API instead of DNS query: more robust and lowers load (during DNS propagation delay)


I wrote this for my own use, and provide no guarantees about it. I'll gladly accept pull requests for feature additions or bug fixes. It works for my own use, and has been running for 2+ years with no issues.

You can’t perform that action at this time.