Back to blog
Guides1 min read

Back up PostgreSQL to any S3 bucket

Schedule dumps, keep as many as you need, restore one in a click, and check that the backup really exists.

A backup you have never restored is a hope, not a backup. This guide sets up scheduled PostgreSQL dumps to an S3 bucket and shows how to check that they are really there.

1. Add a destination

Under Backups, add a destination with the endpoint, the bucket and a key that can write to it. Any S3 compatible storage works: AWS, Cloudflare R2, Backblaze, Garage, MinIO.

Use Test before saving: Deplo writes a small file, reads it back and deletes it.

2. Schedule the dumps

Open the database, choose the destination and a schedule. A cron expression works too:

Shell
# Every night at 03:00
0 3 * * *

Set how many dumps to keep. Older ones are removed from the bucket after each run.

3. Check what landed

Every run shows its size and the object it wrote. To be sure, restore one into a scratch database:

SQL
-- In the restored copy: is the data recent?
SELECT max(created_at) FROM orders;
Editor's note: restore into a new database first, check it, and only then point the app at it.

What is not covered

Dumps are logical backups. For very large databases with heavy writes, combine them with the snapshots your provider offers for the disk.

Ten minutes from now,
it's live.

Answer three questions and pick a host, or install Deplo on a server you already have. It's free, and leaving is as easy as arriving. What you do with the money you save is your business.