DevOps / Scripts
bash
Intermediate
Postgres S3 Backup
Dump a Postgres database, gzip it, push to S3 with AES256 encryption.
bash
#!/bin/bash
DB=$1
STAMP=$(date +%Y%m%d_%H%M%S)
FILE=/tmp/backup_${STAMP}.sql.gz
pg_dump $DB | gzip > $FILE
aws s3 cp $FILE s3://my-backups/postgres/$DB/ --sse AES256 --quiet
rm -f $FILE
Prerequisites
- pg_dump
- aws-cli v2
Pro Tips
- → Set S3 lifecycle to expire old backups.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Sep 2026
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
Disk Usage Alert
Send an alert when any mounted filesystem exceeds a usage threshold.
bash
·
Beginner
Docker Image Cleanup Script
Remove dangling images, stopped containers and unused volumes in one pass.
bash
·
Intermediate
GitLab CI Cache Strategy
Cache node_modules and pip packages per branch in GitLab CI to cut build times.
yaml
·
Intermediate