⚙️ devops8 nodes30-35 min

PostgreSQL → Encrypted S3 Backup

Production-grade database backups you can sleep through. Every night at 2 AM, this workflow runs pg_dump on your PostgreSQL database, gzip-compresses the dump, encrypts it with AES-256, and uploads to S3 (or any S3-compatible storage like Backblaze B2, Cloudflare R2, or MinIO) with a timestamped filename for easy recovery. After upload, it checks the backup count and prunes any older than your retention policy — daily backups kept 30 days, weeklies 90 days, monthlies 1 year. A Slack notification confirms the backup with file size, duration, and status. Optionally runs a verify workflow monthly to test restores.

postgresbackups3encryption
$19

One-time purchase

⬇ Download Free Preview

How It Works

1Schedule

Runs nightly at 2:00 AM for minimal production impact

2Dump

pg_dump captures full database to compressed, encrypted file

3Upload

Uploads to S3 with AES-256 encryption and date-stamped filename

4Prune

Removes backups older than retention: 30d daily, 90d weekly, 1yr monthly

📋 Prerequisites

  • PostgreSQL database with pg_dump access
  • S3-compatible storage bucket (AWS S3, Backblaze B2, Cloudflare R2, MinIO)
  • Encryption key for AES-256
  • Slack webhook (optional, for confirmations)

🎁 What You Get

  • Importable n8n workflow JSON file
  • PostgreSQL pg_dump execution configuration
  • Gzip compression + AES-256 encryption pipeline
  • S3 upload with timestamped filenames
  • Backup retention pruning logic (daily/weekly/monthly)
  • Slack confirmation with backup stats

📖 Setup Guide

## Setup Guide 1. **Schedule Trigger**: Runs daily at 2 AM 2. **Postgres node**: Run pg_dump on target database 3. **Compression node**: Gzip compress the dump file 4. **Encrypt node**: AES-256 encrypt the compressed file 5. **AWS S3 node**: Upload to bucket with timestamp in filename 6. **IF node**: Check backup count in S3 bucket 7. **AWS S3 node**: Delete backups older than 30 days 8. **Slack/Email node**: Confirmation with backup size, duration, status > 💡 **Pro tip**: Test restores monthly with an automated verify workflow. Use different retention: daily (30 days), weekly (90 days), monthly (1 year).

Ready to automate?

Get this template and start automating in 30-35 min. One-time purchase, lifetime access.

Related Templates

Related Blog Posts