You can automate PostgreSQL backups to S3 object storage, and the shortest useful setup is a pg_dump script triggered by a systemd timer. Thirty daily copies of a 20 GB compressed dump, encrypted with age and stored in Cloudflare R2, cost $8.85 a month for 600 GB; the restore time depends on your bandwidth and disk, so measure it in a drill. When you need point-in-time recovery or you run hundreds of gigabytes, move to pgBackRest 2.60.0 with WAL archiving. That is the path this tutorial follows in its second half.

Versions and prices were checked on November 6, 2026. PostgreSQL 18.6 is the current minor release of the 18 branch, whose initial release was September 25, 2025; PostgreSQL 19 RC 1 shipped on October 15, 2026 (PostgreSQL versioning policy). pgBackRest 2.60.0 shipped on October 18, 2026 under the MIT license (release notes). WAL-G 3.0.9, the other serious WAL archiving tool, was released on August 20, 2026 (releases). Object storage prices were collected in November 2026, excluding taxes, from the R2, B2, Hetzner and S3 pricing pages.

Two levels, two different promises#

A PostgreSQL backup answers two separate questions. The first is recovery point objective, or how much data you can lose: if the disk dies now, how many minutes of transactions disappear? The second is recovery time objective, or how long it takes to serve traffic again. A daily logical dump gives you a 24-hour RPO and an RTO that depends on database size. A physical backup with WAL archiving gives you seconds of data loss and point-in-time recovery, at the cost of more moving parts.

pg_dump produces a consistent export even while the database is in use. PostgreSQL's documentation states that it blocks neither readers nor writers. It is still a transfer tool, not a complete backup system: the same page says that, except in simple cases, pg_dump is generally not the right choice for regular production backups, and points to Chapter 25 on backup and restore. Use it for databases under 50 GB, pre-migration exports and test copies. Use pgBackRest when a dropped table or a lost disk must be recoverable.

Object storage adds three properties a local disk does not have: it lives outside the server, it is replicated by the provider and it bills by usage. It does not replace a logical dump. A volume snapshot captures the disk at one moment; if you delete a row at 2 p.m., last night's snapshot does not save you. A dump or a WAL archive represents the logical state of the database, not the blocks of the file system.

If you are still choosing a host for the database, our Neon vs Supabase vs PlanetScale comparison covers managed Postgres plans and their backup limits. On a VPS, our Next.js deployment tutorial with Coolify covers the server, proxy and environment variables; our Docmost Docker Compose guide shows how an app and its database share a machine. The rest of this guide works with any PostgreSQL 14 to 18 server, self-hosted or managed, as long as you can connect with a backup role.

Picking object storage in 2026#

Four providers cover most backup workloads. Cloudflare R2 removes egress fees, which matters the day you restore 200 GB. Backblaze B2 lists $6.95/TB with full Object Lock. Hetzner Object Storage includes 1 TB in a €6.49 monthly plan, then charges €6.26/TB, so beyond the first terabyte it is cheaper than B2, with three European regions instead of a global footprint. AWS S3 is the reference, with the widest choice of regions, IAM policies and third-party tools.

CriterionCloudflare R2Backblaze B2Hetzner Object StorageAWS S3 Standard
Storage$0.015/GB-month$6.95/TB-month€6.49 excl. VAT/month for 1 TB included$0.023/GB-month, first 50 TB
EgressFreeFree up to 3× stored data, then $0.01/GB1 TB included, then €1/TB$0.09/GB after 100 GB/month
Requests$4.50/million Class A, $0.36/million Class BIncluded, Class D at $0.004/10,000 after 2,500/dayIncluded$0.005/1,000 PUT, $0.0004/1,000 GET
Free tier10 GB, 1 million Class A, 10 million Class B10 GBNone, the plan starts at 1 TBNo permanent free storage
Versioning and Object LockNot exposed by the S3 API at this dateFull Object LockObject Lock and versioningObject Lock and versioning
RegionsGlobalUnited States and EuropeGermany and Finland onlyGlobal
Backup advantageFree egress, simple billLow per-TB cost and immutabilityPredictable EU planCompliance and ecosystem

These figures are from November 6, 2026; check the grid before sizing a bucket. Cloudflare charges $0.015 per GB-month for Standard storage and $0.01 for Infrequent Access, with 10 GB free on Standard only; Infrequent Access has a 30-day minimum billable duration, even if you delete the object sooner. Backblaze lists $6.95 per TB-month, no minimum file size or storage duration, and 10 GB free. Hetzner charges €6.49 excluding VAT per month for 1 TB of storage and 1 TB of egress, then €6.26 per additional TB of storage and €1 per TB of egress; objects under 64 KB are billed as 64 KB. AWS S3 Standard starts at $0.023 per GB-month for the first 50 TB, with 100 GB of monthly egress free.

Prepare the bucket and credentials#

Create a dedicated bucket, for example pg-backups, and a token scoped to that bucket. On Cloudflare R2, the endpoint looks like https://<ACCOUNT_ID>.r2.cloudflarestorage.com and the S3 region is auto; an R2 bucket also accepts us-east-1 as an alias. On Backblaze B2, the endpoint depends on the region, for example s3.us-west-004.backblazeb2.com with region us-west-004. On Hetzner, the endpoint follows the region, for example fsn1.your-objectstorage.com. In all three cases, use the endpoint and region shown in the provider console.

The script needs five values: endpoint, region, bucket, access key and secret key. Store them in a file readable only by root and by the user that runs the backup. Do not put them in the script, in Git, or on a command line, because ps can display them. PGSSLMODE=require encrypts the connection but does not verify the server identity; for a remote database, prefer verify-full with PGSSLROOTCERT.

bash
sudo install -m 640 -o root -g postgres /dev/null /etc/pg-backup.env
sudoedit /etc/pg-backup.env
bash
S3_ENDPOINT=https://<ACCOUNT_ID>.r2.cloudflarestorage.com
S3_REGION=auto
S3_BUCKET=pg-backups
AWS_ACCESS_KEY_ID=<access-key>
AWS_SECRET_ACCESS_KEY=<secret-key>
AGE_RECIPIENT=age1<public-key>
PGHOST=db.example.com
PGPORT=5432
PGDATABASE=app
PGUSER=backup
PGSUPERUSER=postgres
PGPASSFILE=/etc/pg-backup.pgpass
PGSSLMODE=require

The .pgpass file contains one line in the form host:port:database:user:password. It must belong to the user running pg_dump and be mode 0600; otherwise PostgreSQL ignores it. Create a backup role that can read every table but cannot write:

sql
CREATE ROLE backup LOGIN PASSWORD 'replace-me';
GRANT CONNECT ON DATABASE app TO backup;
GRANT USAGE ON SCHEMA public TO backup;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO backup;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO backup;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO backup;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON SEQUENCES TO backup;

Repeat these grants for every schema the application uses.

Test bucket access before writing the script. The following command should return without an error:

bash
set -a
. /etc/pg-backup.env
set +a
aws s3 ls "s3://$S3_BUCKET" \
  --endpoint-url "$S3_ENDPOINT" \
  --region "$S3_REGION"

If you use age for client-side encryption, generate the key pair on your workstation, not on the database server. Copy only the public key into /etc/pg-backup.env and keep the private key offline, in a password manager or on an encrypted disk. A private key stored on the server lets an attacker decrypt every backup they can download.

bash
age-keygen -o backup-age.key
age-keygen -y backup-age.key

Level 1: pg_dump, zstd, age and aws s3 cp#

The script below backs up one database plus roles and tablespaces, computes a SHA-256 checksum, encrypts the archive with age and uploads it under a dated prefix. It uses set -euo pipefail to stop on the first error and mktemp -d so no plaintext dump is left on disk.

bash
#!/usr/bin/env bash
set -euo pipefail

set -a
. /etc/pg-backup.env
set +a

umask 077
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
cd "$WORK"

pg_dump \
  --format=custom \
  --compress=zstd:9 \
  --file=app.dump \
  --dbname="$PGDATABASE"

PGUSER="$PGSUPERUSER" pg_dumpall --globals-only --file=globals.sql

sha256sum app.dump globals.sql > SHA256SUMS

tar -cf backup.tar app.dump globals.sql SHA256SUMS

age -r "$AGE_RECIPIENT" -o backup.tar.age backup.tar

aws s3 cp backup.tar.age \
  "s3://$S3_BUCKET/postgres/$STAMP/backup.tar.age" \
  --endpoint-url "$S3_ENDPOINT" \
  --region "$S3_REGION" \
  --only-show-errors

REMOTE_SIZE=$(aws s3api head-object \
  --bucket "$S3_BUCKET" \
  --key "postgres/$STAMP/backup.tar.age" \
  --endpoint-url "$S3_ENDPOINT" \
  --region "$S3_REGION" \
  --query ContentLength --output text)

[ "$REMOTE_SIZE" -eq "$(stat -c %s backup.tar.age)" ] || {
  echo "remote size $REMOTE_SIZE differs from local size" >&2
  exit 1
}

The custom format is compressed by default and accepts zstd:9. zstd requires a pg_dump client from PostgreSQL 15 or newer (PostgreSQL 15 release notes); with a version 14 client, use --compress=9 (gzip) or install the version 18 client. The custom format lets pg_restore select objects, which a raw SQL script cannot do. The directory format with --jobs=4 is faster on a large database, but it creates a directory and opens jobs + 1 connections; reserve it for databases above 50 GB and check max_connections.

pg_dumpall --globals-only exports roles and tablespaces, which pg_dump does not save (pg_dumpall documentation). Without it, a restore to a fresh cluster fails on ownership or permissions. If you run several databases, pgBackRest backs them all up in the same repository; with pg_dump, loop over the databases and keep one file per database, or use pg_dumpall for a single SQL script. It needs an administrator role to read password hashes, so the .pgpass file must also cover that role, with the postgres database or a * wildcard. The dump contains those hashes, which is why the archive is encrypted before it leaves the server. Tablespace directories must exist on the target before the restore.

Restore in the opposite order. Download the archive, decrypt it, verify the checksum, create a disposable database, restore roles and then the database:

bash
aws s3 cp "s3://$S3_BUCKET/postgres/20261106T033000Z/backup.tar.age" . \
  --endpoint-url "$S3_ENDPOINT" \
  --region "$S3_REGION"

age --decrypt -i backup-age.key backup.tar.age > backup.tar
tar -xf backup.tar
sha256sum -c SHA256SUMS

psql -X -d postgres -f globals.sql
createdb -T template0 app_restore
pg_restore --exit-on-error -d app_restore app.dump

The dump preserves ownership and privileges. If you restore into an environment where roles have different names, add --no-owner and --no-privileges to pg_restore, then recreate the appropriate grants. Also add --single-transaction so a failure rolls back the whole restore instead of leaving a half-loaded database.

psql -X avoids loading a .psqlrc that could change restore behavior. "role already exists" errors on the bootstrap role are normal, as the pg_dumpall documentation notes. Download and restore time depends on archive size, bandwidth and disk. Measure your own RTO in a drill instead of reusing an estimate.

Level 2: pgBackRest and WAL archiving#

pgBackRest copies cluster files and archives WAL segments (user guide). A restore can stop at a precise timestamp, which covers an accidental table drop or a failed migration. The tool also handles compression, encryption, retention and uploads to S3, Azure or GCS. This part assumes you can restart PostgreSQL and edit postgresql.conf.

Install pgBackRest from the PostgreSQL repository, which usually carries a newer version than some distribution repositories. The commands below target Debian and Ubuntu; adapt them for other distributions.

bash
sudo apt update
sudo apt install -y curl ca-certificates gnupg
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
  | sudo gpg --dearmor -o /usr/share/keyrings/postgresql.gpg
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt $(. /etc/os-release; echo $VERSION_CODENAME)-pgdg main" \
  | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt install -y pgbackrest
sudo -u postgres pgbackrest version

Check the data directory before writing the configuration. pg1-path must match the output of SHOW data_directory, otherwise the backup refuses to start.

bash
sudo -u postgres psql -Atc "show data_directory"

Create /etc/pgbackrest/pgbackrest.conf. S3 credentials and the encryption passphrase stay in this file, readable by postgres only. repo1-cipher-type=aes-256-cbc encrypts the repository on the client: even if the provider reads the bucket, it sees opaque bytes. Do not store the passphrase in the same bucket as the backups. The repo1-* and compress-type options are described in the configuration reference.

ini
[global]
repo1-type=s3
repo1-s3-bucket=pg-backups
repo1-s3-endpoint=https://<ACCOUNT_ID>.r2.cloudflarestorage.com
repo1-s3-region=auto
repo1-s3-key=<access-key>
repo1-s3-key-secret=<secret-key>
repo1-s3-uri-style=path
repo1-path=/pgbackrest
repo1-cipher-type=aes-256-cbc
repo1-cipher-pass=<long-random-passphrase>
repo1-retention-full=2
repo1-retention-diff=6
repo1-bundle=y
repo1-block=y
compress-type=zst
process-max=2
start-fast=y
log-level-console=info

[app]
pg1-path=/var/lib/postgresql/18/main

repo1-s3-uri-style=path avoids certificate errors on S3-compatible endpoints that do not accept bucket.endpoint style. Many self-hosted services and several object storage products require it. For Backblaze B2, replace the endpoint and region with your bucket's values, for example s3.us-west-004.backblazeb2.com and us-west-004. For Hetzner, use the regional endpoint, for example fsn1.your-objectstorage.com.

Enable WAL archiving. wal_level=replica is the default on recent releases, but writing it explicitly avoids surprises during a configuration migration. archive_mode needs a restart; archive_command can be reloaded without one.

sql
ALTER SYSTEM SET wal_level = 'replica';
ALTER SYSTEM SET archive_mode = 'on';
ALTER SYSTEM SET archive_command = 'pgbackrest --stanza=app archive-push %p';
ALTER SYSTEM SET archive_timeout = '60s';

With archive_timeout=60s, PostgreSQL forces a WAL segment at least every 60 seconds, even when the database receives almost no writes. A segment is 16 MB by default, so an idle database can add about 23 GB of WAL per day. Adjust the value to your RPO and your storage bill.

bash
sudo systemctl restart postgresql
sudo -u postgres pgbackrest --stanza=app stanza-create
sudo -u postgres pgbackrest --stanza=app check

stanza-create initializes the tracking files in the repository. check forces a WAL segment switch and verifies that archiving really works. If check fails, stop there: a backup whose WAL archive is broken cannot provide point-in-time recovery. Inspect pg_stat_archiver for the failure count and the last failed segment.

sql
SELECT archived_count, failed_count, last_archived_wal, last_failed_wal
FROM pg_stat_archiver;

Run a first full backup, then inspect the repository:

bash
sudo -u postgres pgbackrest --stanza=app --type=full backup
sudo -u postgres pgbackrest --stanza=app info

The info output should show status: ok and a full backup. The wal start/stop fields show the WAL range required to make the backup consistent. repo1 shows the compressed size actually stored. The first backup copies the whole cluster; the next differential copies only changed blocks when repo1-block=y.

Schedule it with systemd#

A systemd timer is easier to audit than cron: it logs output, records failures and can catch up after a reboot. The service below runs the level 1 pg_dump script. For pgBackRest, replace ExecStart with /usr/bin/pgbackrest --stanza=app --type=incr backup and keep a weekly timer for --type=full.

ini
[Unit]
Description=PostgreSQL backup to S3
Wants=network-online.target
After=network-online.target postgresql.service

[Service]
Type=oneshot
User=postgres
Group=postgres
EnvironmentFile=/etc/pg-backup.env
ExecStart=/usr/local/bin/pg-backup.sh
Nice=10
IOSchedulingClass=best-effort
IOSchedulingPriority=7
ini
[Unit]
Description=PostgreSQL backup timer

[Timer]
OnCalendar=*-*-* 03:30:00
Persistent=true
RandomizedDelaySec=20m

[Install]
WantedBy=timers.target
bash
sudo install -m 750 -o postgres -g postgres pg-backup.sh /usr/local/bin/pg-backup.sh
sudo systemctl daemon-reload
sudo systemctl enable --now pg-backup.timer
systemctl list-timers pg-backup.timer
sudo systemctl start pg-backup.service
journalctl -u pg-backup.service -n 50 --no-pager

Persistent=true runs the backup at boot if the scheduled time passed while the machine was off. RandomizedDelaySec=20m stops every machine from uploading at 3:30 a.m. and saturating the network. The service runs as postgres so it can read the data and the .pgpass file, but the script itself should stay readable by root only if it contains secrets.

An exit code alone is not enough: a dump can succeed and produce an empty archive. Add a minimum size check and verify the latest object in the bucket. For pgBackRest, this command exits non-zero when the repository is unhealthy or the latest backup is older than 26 hours:

bash
sudo -u postgres pgbackrest --stanza=app --output=json info \
  | jq -e '.[0].status.code == 0 and (.[0].backup[-1].timestamp.stop > (now - 93600))'

In the JSON output, status is an object {code, message}, not a string, so status.code == 0 is the correct test. Backups are ordered oldest to newest, so backup[-1] targets the latest one.

Verify, restore and measure#

Until you restore an archive, you do not know what it contains or how long the restore takes. The minimum test restores into a disposable database and compares a few row counts. The full test restores to a separate server, starts the application and checks the critical paths. Do it at least once a quarter, and after every PostgreSQL major version change.

For pg_dump, the restore is shown above. At minimum, confirm that pg_restore --list reads the archive, that roles exist and that the main tables contain rows:

bash
pg_restore --list app.dump | head -40
psql -X -d app_restore -c "select count(*) from users;"
psql -X -d app_restore -c "select count(*) from orders;"

For pgBackRest, stop PostgreSQL, restore the cluster and start it again. --delta compares files against the manifest checksums and rewrites only what differs; it is faster than a full restore on an existing disk, but it removes files that are absent from the backup.

bash
sudo systemctl stop postgresql
sudo -u postgres pgbackrest --stanza=app --delta restore
sudo systemctl start postgresql

For point-in-time recovery, provide a UTC target and ask the server to promote at the end of WAL replay. Round the target down to the minute before the incident: if the deletion happened at 14:32, target 14:31.

bash
sudo systemctl stop postgresql
sudo -u postgres pgbackrest --stanza=app \
  --type=time \
  --target='2026-11-06 14:31:00+00' \
  --target-action=promote \
  restore
sudo systemctl start postgresql

pgbackrest verify rereads repository files and checks their checksums. Run it after the first backup and then periodically. Since 2.60.0, restore and expire fail on a page with an invalid checksum; checksum-page-error=n turns that back into a warning. Without the passphrase, pgbackrest restore cannot decrypt the repository: keep it in a password manager, not in the same bucket.

bash
sudo -u postgres pgbackrest --stanza=app verify

Security, retention and immutability#

Client-side encryption is the first protection. AWS S3, Backblaze B2 and Hetzner also offer encryption at rest, but that protects the provider's disk, not your data from a configuration mistake or an access with your credentials. age and pgBackRest encrypt before upload; the provider stores opaque bytes.

The second protection is credential separation. Use a dedicated bucket, a token scoped to that bucket and a read-only PostgreSQL role. Do not reuse the application's key. If your provider supports it, create two sets of keys: one to write backups, one to read them during a restore. A compromised key should not be able to delete the entire history.

The third protection is immutability. Object Lock prevents deletion or overwriting for a defined period and requires versioning on the bucket. Backblaze B2 exposes full Object Lock, Hetzner offers Object Lock and versioning, and AWS S3 offers both. Cloudflare R2's S3 compatibility page stated on October 14, 2026 that Object Lock and versioning are not exposed by the S3 API; choose B2, Hetzner or S3 when you need WORM (write once, read many). Enable Object Lock when you create the bucket, not after the first incident.

Retention must keep more than one full backup. repo1-retention-full=2 keeps two full backups and their dependent differentials; a full backup is expired only after the next one succeeds. Do not set a bucket lifecycle rule to delete objects after 30 days if your only full backup is 45 days old. Use a prefix per environment (postgres/prod/, postgres/staging/) and a lifecycle rule that leaves at least two full backups and the required WAL window.

The 3-2-1 rule still applies: three copies, two media, one offsite. Object storage is the offsite copy. Keep a local repository with repo2 for fast restores during a network incident, or a local encrypted dump. pgBackRest accepts multiple repositories: repo1 on S3, repo2 on a local disk, with different retention.

Watch costs as well. List and read requests are billed by some providers, and an emergency restore can move hundreds of gigabytes. R2 and B2 have generous egress terms; AWS charges $0.09 per GB after 100 GB per month. Test a real restore to learn the cost, not just the advertised storage price.

What 600 GB of backups costs#

Take an 80 GB database that compresses to 20 GB, with 30 daily copies retained, for 600 GB total. The figures below are estimates excluding taxes, using prices checked in November 2026. They exclude requests, usually negligible for 30 objects per month, and the egress of a restore.

Provider600 GB storedNote
Cloudflare R2about $8.85/month600 GB × $0.015, minus 10 GB free
Backblaze B2about $4.10/month0.6 TB × $6.95, minus 10 GB free
Hetzner Object Storage€6.49 excl. VAT/month600 GB fits in the included 1 TB
AWS S3 Standardabout $13.80/month600 GB × $0.023, before requests

At 3 TB of backups the ranking changes: R2 stays at about $45/month, B2 lands around $21/month, Hetzner charges the 1 TB plan plus 2 TB at €6.26/TB, about €19.01 excluding VAT, and AWS reaches about $70/month. The more you store, the more B2 and Hetzner's per-terabyte pricing matters. R2's free egress remains an advantage for frequent restores.

Failures that block a restore#

The wrong endpoint or region. R2 uses the auto region; B2 uses your bucket's region, for example us-west-004; Hetzner uses the endpoint's region. Setting S3_REGION to us-east-1 on a European B2 bucket returns a signature error that is hard to read.

The wrong URL style. pgBackRest defaults to host, which builds bucket.endpoint. S3-compatible services without a wildcard certificate then fail certificate validation. Set repo1-s3-uri-style=path for R2, B2 and Hetzner.

A pg_dump older than the server. pg_dump cannot read a server newer than its own major version; it refuses instead of producing a doubtful archive. Install the client for the server's major version, or newer.

An ignored .pgpass. The file must be 0600, owned by the user running the command, with no spaces around the colons. PGPASSFILE must point to the right path. A password containing : or \ must be escaped.

A WAL archive that fails quietly. archive_command returns an error, PostgreSQL retries and pg_wal grows. Watch pg_stat_archiver.failed_count and disk space. pgbackrest check forces a segment and detects the problem before a backup depends on an incomplete archive.

Retention that is too aggressive. repo1-retention-full=1 keeps a single full backup. If the new backup is corrupt, the old one is already expired. Keep at least two full backups and test a restore of the oldest one.

A restore on the wrong major version. A pgBackRest physical backup restores on the same PostgreSQL major version. To move from 17 to 18, use pg_upgrade or a logical dump. Do not expect pgBackRest restore to change major versions.

A forgotten time zone. PITR targets are interpreted in the server's time zone if you omit an offset. Write +00 and work in UTC to avoid a one-hour error at the worst possible moment.

Frequently asked questions#

Frequently asked questions

What is the difference between pg_dump and pgBackRest?

pg_dump exports one database to a logical file without blocking readers or writers. It is enough for a small database, a pre-migration export or a test copy. pgBackRest copies the cluster and archives WAL, which enables point-in-time recovery, incremental backups and automatic retention. For production that must survive a table drop, use pgBackRest.

Does Cloudflare R2 work with pgBackRest?

Yes. R2 exposes an S3 API with the endpoint https://<ACCOUNT_ID>.r2.cloudflarestorage.com and the region auto. Set repo1-s3-uri-style=path and use a token scoped to the bucket. R2's S3 compatibility page stated on October 14, 2026 that Object Lock and versioning are not exposed by the S3 API; for WORM protection, look at B2, Hetzner or S3.

Should I encrypt backups before uploading them?

Yes, if you want the provider to be unable to read the data. Encryption at rest on S3, B2 or Hetzner protects the medium, but in managed mode the provider holds the keys. age encrypts with a public key and pgBackRest encrypts the repository with AES-256-CBC on the client. In both cases, keep the private key or passphrase off the server and out of the bucket.

How long does a restore take?

The duration depends on archive size, bandwidth and disk. A pgBackRest restore with --delta rewrites only files that differ, which can reduce time on an existing cluster. Measure your RTO on your archive and your bandwidth: a drill gives the duration, an estimate does not.

What retention should I choose?

Keep at least two full backups, several differentials and enough WAL for your acceptable data loss. For an e-commerce application, 7 to 30 days of WAL and two full backups cover most incidents. For data under a legal retention requirement, the law sets the duration, not the storage price. Make sure the bucket lifecycle rule does not delete the oldest full backup before the retention window ends.

Is a provider snapshot enough?

No. A snapshot captures the disk or volume at one moment, but it cannot return to a precise transaction and it depends on the same provider. A logical dump or a WAL archive is portable to another server, another minor version and another provider. Keep the snapshot for fast disk replacement, and the logical backup for disaster recovery.

Sources#

Official pages consulted on November 6, 2026. Prices checked in November 2026, excluding taxes where marked.