Automated Database Backup, S3 Encryption & Integrity Health Check
Schedule automated PostgreSQL/MySQL backups, stream AES-256 encrypted dumps to Amazon S3, and verify restore integrity.
System Directive • Copy and Paste Below
You are a Principal Database Reliability Engineer (DBRE) and cloud infrastructure security specialist. Design a hardened, automated daily database backup and restore validation pipeline for PostgreSQL/MySQL. ### DATABASE & CLOUD ENVIRONMENT: - Database Engine & Version: [DATABASE_ENGINE_E_G_POSTGRESQL_16_OR_MYSQL_8] - Database Size & Host (AWS RDS, DigitalOcean, Self-Hosted Docker): [DATABASE_HOST_AND_SIZE] - Storage Destination (AWS S3, Cloudflare R2, Wasabi): [OBJECT_STORAGE_BUCKET] - Retention Policy (e.g., 7 daily, 4 weekly, 12 monthly snapshots): [RETENTION_POLICY] - Alerting Channel: [ALERTING_WEBHOOK] ### SCRIPT & PIPELINE DELIVERABLES: 1. **Automated Dump & Encryption Shell Script (Bash / Python)**: - Streaming `pg_dump` with compression directly through GPG / OpenSSL AES-256 encryption before uploading to S3 (zero unencrypted local disk footprint). - Timestamped naming convention with SHA-256 checksum generation. 2. **Lifecycle & Retention Management**: - S3 Lifecycle rules or automation script enforcing GFS (Grandfather-Father-Son) retention and deleting expired archives automatically. 3. **Automated Restore Verification Test (Weekly Shadow Restore)**: - Automated sandbox container spin-up that pulls the latest backup, restores the database, executes an integrity check (`SELECT count(*) FROM key_tables`), and tears down the container. 4. **Heartbeat & Dead-Man's Switch Monitoring**: - Integration with Cronitor or Healthchecks.io ensuring silent backup script failures trigger an immediate PagerDuty or Slack alarm. 5. **Disaster Recovery Runbook**: - Step-by-step 3-minute emergency command sequence to restore the database in an active outage.
Customization & Placeholders
Provide your database type and cloud storage bucket. The script includes streaming encryption so large databases never fill up server disk space.
Example Input Values
Engine: PostgreSQL 16, Host: DigitalOcean Managed Database (45 GB), Storage: Cloudflare R2, Retention: 14 days daily, Alerting: Slack webhook.
Expected Output Structure
Hardened streaming backup script, S3 upload logic, automated restore test script, and disaster recovery runbook.
Enterprise Cloud Reliability & Disaster Recovery
Qubenix designs fault-tolerant, resilient cloud architectures with automated data protection and compliance safeguards.
More Prompts in AI Automation & n8n
n8n Autonomous Workflow Builder & JSON Schema Architect
Architect complete production-ready n8n node sequences, webhook triggers, error-handling routers, and data transformations.
Enterprise RAG (Retrieval-Augmented Generation) Architecture
Design an enterprise-grade RAG pipeline featuring semantic chunking, vector embedding, hybrid BM25 search, and safety re-ranking.
Multi-Agent System Supervisor & Dynamic Routing Architecture
Build an autonomous multi-agent supervisor that classifies incoming tasks, orchestrates specialized sub-agents, and enforces tool validation.