Flow to update Cloudflare DNS records with current IP address

In case anyone finds it useful, I have added a flow to the node-red flows site that interrogates Cloudflare DNS records and automatically updates them where necessary.
I have used a request to http://ipinfo.io/ip to determine the current external IP address, but I don't know whether there are significant limitations to its validity, so any input on that would be useful.



Wow! I wasn't expecting that...

A half, or more, of the nodes are involved in detecting and reporting all the various errors that might occur, along with showing status.

I've been using a similar solution;


Although it hasn't given me any problems over the past 3-4 years, my flow isn't as comprehensive as yours, and has no error checking :sleepy:
I don't check if the IP has changed before updating the cloudflare server, I just update it every 15 minutes regardless (I checked with the cloudflare team, and they said that was perfectly acceptable).
My api key, etc, are hardcoded in the curl script, in the template node.
Also, I use https://api.ipify.org/ to obtain my ip, which has proved very reliable.

As always, nice job Colin.

Does that just do one domain? Which is fine if that is all you need of course.

I didn't like the idea of the API key being visible in the source. I have put it in a password type field in the subflow properties.

That's cheating :slight_smile:

1 Like

An advantage of doing the DNS record lookup in Cloudflare is that it tells you the record ID, saving the user the effort of trying to find that. Having done the lookup it is then easy to check whether the IP is already correct.

I just did a lookup once, when I first created the flow, and then hard coded the record ID in the script, to avoid future duplicity.

Yes, but you had to work out how to do that. While I was trying to work it out, google found a very helpful request on the cloudflare forum for advise on how to do that, from someone whose name I am sure I recognised. :slight_smile:

1 Like