Consul Backup

Consul backup creates a snapshot of the entire Consul state using the Consul HTTP API.

Backup Process:

The consul-backup.sh script performs the following operations:

(Click the file name above to download the script.)

  1. Starts a temporary backup pod with curl support
  2. Tests connectivity to the Consul service endpoint
  3. Downloads a snapshot via the Consul HTTP API
  4. Copies the snapshot from the pod to the local file system.
  5. Cleans up the temporary pod automatically.

Running the Backup:

./consul-backup.sh

Expected Output:

========================================
Consul Backup Script
========================================

[i] Starting backup pod...
[✓] Backup pod ready
[i] Testing Consul endpoint...
[✓] Connected to Consul
[i] Creating Consul snapshot...
[i] Copying snapshot from pod...
[✓] Snapshot created: 4.5K

========================================
Backup Complete
========================================
File: ./consul-backup-20251103-121841.snap
Size: 4.5K

What Gets Backed Up:

  • Service registrations and health checks

  • Key-value store data

  • ACL tokens and policies

  • Prepared queries

  • Sessions and locks

  • Intentions (service mesh configurations)

Backup File Location: The snapshot file is created in the current directory as consul-backup-<timestamp>.snap.