Skip to content

Shell Script to Backup Cloudflare DNS Zone through the API

License

Notifications You must be signed in to change notification settings

Swaegy/cloudflare_api_dns_backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Cloudflare API DNS Backup

A bash script used to access the Cloudflare API remotely to backup the DNS Zone Configuration.

Requirements

A Remote system for running the script and saving the output.
(Iam using Debian for example, curl needs to be installed)

Setup Cloudflare

You need to create an API Token and get the Zone ID of the DNS Zone you want to Backup.
Create Cloudflare API Key
Get Cloudflare DNS Zone ID

Example Config Debian

Install the dependencies for debian to run the script

$ sudo apt install curl

Make the script executable

$ sudo chmod u+x /*pathtobackupscript*/cloudflare-api-dns-backup.sh

Execute the script through crontab, in the example at 1 in the morning

$ sudo crontab -e

0 1 * * * /*pathtobackupscript*/cloudflare-api-dns-backup.sh

Sources

https://github.com/curl/curl
https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-export-dns-records

License

This repository is licensed under the GNU General Public License v3.0.
For more information, see the LICENSE file.

Disclaimer

This repository is for educational and informational purposes only.
The author assumes no liability for any damages that may arise from the use of the contents of this repository.

Contributions

Contributions are always welcome! If you find an error or would like to suggest an improvement, please create an issue.

About

Shell Script to Backup Cloudflare DNS Zone through the API

Topics

Resources

License

Stars

Watchers

Forks

Languages