You will need the following to get dynamic DNS working on Cloudflare:

  • Cloudflare as your DNS provider. Migrating from your current DNS provider over to Cloudflare is easy and free whether you are using Godaddy, Namecheap or another one.

  • Get API token set up on Cloudflare.

  • Install cloudflare-cli.

Cloudflare API token

Cloudflare Token is preferred way over API key as token enables added security by allowing to specify access level with permissions and resources.

Token can be disabled when not in use.

When those are met, a one-liner like the following will update A record with your public internet IP.

NOTE: If you are only using DDNS on Cloudflare and not using its CDN, remove --activate from the command below.

    $ env CF_API_KEY='your-own-cloudflare-token-NOT-api-key' \
        CF_API_DOMAIN='' \
        cfcli --activate --type A edit \
        `curl -s ''` ;

Finally, put the code it into crontab will automate the process.