Skip to content
A script to update your Cloudflare DNS records at a glance.
Branch: master
Clone or download
This branch is 17 commits ahead of thatjpk:master.

Latest commit

Latest commit c90dac0 Dec 17, 2017


Type Name Latest commit message Commit time
Failed to load latest commit information.
logs Improved error messages & quiet config option Jul 2, 2014
zones Fix typo Dec 17, 2017
.gitignore New version Jun 19, 2017
LICENSE Add LICENSE file Dec 6, 2015 Fix typos Aug 22, 2017 Featured: multi `-z` option in-one-line Aug 1, 2017
requirements.txt New version Jun 19, 2017


This is a continued version of thatjpk's cloudflare-ddns.


A script for dynamically updating Cloudflare DNS records. If you have a dynamic IP and you're hosting servers behind it, it's an easy way to make it 'pseudo-static'.


You'll need a Python interpreter and the following libraries:

You can install them with pip: pip install -r requirements.txt


  • Two ways to grab your IP address
    • HTTP
    • DNS lookup (dig)
  • IPv4 and IPv6 support (A and AAAA records)
  • Logging
  • One configuration file for multiple records
  • Multiple record settings:
    • Time to Live (TTL)
    • Proxy mode
    • Logging level
  • Lightweight
  • Smart update (your record will only be updated if needed)


First, a few assumptions:

  • You're using Cloudflare to host DNS for a domain you own.
  • You have one or more A/AAAA records in Cloudflare you intend to dynamically update.

To use this utility, create a copy of the file inside the zones folder and rename it to your zone name. To do a one-off update of your DNS record, simply run python -z from your terminal. The script will determine your public IP address and automatically update the records along with it and the settings you provided.

If the program encounters an issue while attempting to update Cloudflare's records, you can check the the logs folder for more informations.

Because dynamic IPs can change regularly, it's recommended that you run this utility periodically in the background to keep your records up-to-date.

Just add a line to your crontab and let cron run it for you at a regular interval.

# Every 30 minutes, update my Cloudflare records.
*/30 * * * * python /path/to/ -z

This example will update your records every 30 minutes. You'll want to be sure that you insert the correct paths to reflect where the codebase is located.

If you want to learn more about the Cloudflare API, you can read on here.

Credits and Thanks

  • Cloudflare for having an API and otherwise generally being cool.
  • for making grabbing your public IP from a script super easy.
  • thatjpk for the initial releases of this project.
You can’t perform that action at this time.