CloudFlare Bulk IP Switcher

A little while back, I had to move a bunch of web services that were hosted on a VPS to a new datacenter. As part of the move, I wasn’t able to transfer the IPs, so I was assigned a new IP. So, now I had to update all of my DNS records to reflect the change. Owning multiple domains, I realized that CloudFlare doesn’t provide an easy way to make this IP change across multiple zones (domains).

If I wanted to change the records in each zone, I would need to export the DNS records in BIND format, make the changes, and then reupload the records. To fill this gap, I created a simple bulk IP changer that uses the CloudFlare API to iterate through all the zones and find all instances of the original IP address and replace the value with a new IP. I recently had the time to clean up this code, and I have now released it as open source.

The source code is available on GitHub under an MIT license.

Comments

One response to “CloudFlare Bulk IP Switcher”

  1. Andy Francis Avatar

    Thank you for doing this !! This is awesome. I had 400 DNS records to modify and it save me SO much time.

    I had to fiddle with user auth a little because my CloudFlare account is a little wierd.

    Weird thing
    User authentication was successful, but for my account ‘first name=null’ and ‘not user’ returns TRUE and the program exists. I commented out the check for successful auth and it worked fine.

    Thanks again for great work!

    Andy Francis

Leave a Reply

Your email address will not be published. Required fields are marked *