← Back to Tools
Open Source Tool
Cloudflare DNS Backup
Automated Bash script that backs up every DNS record across all your Cloudflare zones via the API. Exports to timestamped JSON files — run it before DNS changes, on a daily cron, or after incidents to maintain a recoverable record of your DNS state.
Run before and after every DNS change. If something breaks, you have an exact record of what existed — and can restore it manually or via re-import in minutes.
What it does
- Backs up all DNS record types — A, AAAA, CNAME, MX, TXT, NS, SRV, CAA
- Exports all zones in your Cloudflare account automatically
- Saves timestamped JSON files per zone for easy diffing and audit trails
- Uses Cloudflare API v4 with Bearer token auth — no password required
- Minimal dependencies — pure Bash and curl, runs anywhere
- Designed for cron scheduling — set-and-forget daily backups
Quick start
# Clone the repo git clone https://github.com/mylesagnew/cloudflare-backup cd cloudflare-backup # Set your Cloudflare API token export CF_API_TOKEN=your_token_here # Run backup — exports all zones to ./backups/ ./backup.sh # Optional: schedule daily via cron crontab -e # 0 2 * * * /path/to/cloudflare-backup/backup.sh
Related resources
Get notified when new tools and checklists drop.
Join Security Tool Updates →