Documentation

Docs / Object storage

S3 backups with the AWS CLI, rclone or restic

A bucket keeps a backup off the machine it protects. A backup tool that lets you set a custom S3 endpoint and path-style addressing can write to it, from a server, a CI job or your laptop, whether or not the data lives on Resilis. This page shows example setups for the AWS CLI, rclone and restic, and what to know before you rely on them.

Create a bucket and a backup credential

Create a bucket for backups, such as backups, and issue a read-and-write credential for it. Write access also allows reads, which backup tools need to list and restore what they wrote. Choose an expiry of never, 24 hours, 7 days or 30 days: a scheduled job stops when its credential expires, so either rotate the key before then or choose never and revoke it when the job is retired.

Copy the endpoint, the region and the key pair from the credential drawer into the secret store of the machine that runs the job. The examples read them from the variables STORAGE_ENDPOINT, STORAGE_REGION, STORAGE_ACCESS_KEY_ID and STORAGE_SECRET_ACCESS_KEY. The endpoint includes a path, /s3 after the host name, so use it exactly as shown.

Stream a database dump with the AWS CLI

Set path-style addressing once, then pass the endpoint with --endpoint-url. The AWS CLI reads the key pair from AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and the region from AWS_DEFAULT_REGION. A hyphen as the source makes aws s3 cp read from standard input, so a dump goes to the bucket without a local file.

Example: pg_dump to a bucket with the AWS CLI

# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and
# AWS_DEFAULT_REGION come from the bucket credential.
aws configure set default.s3.addressing_style path

pg_dump --format=custom "$DATABASE_URL" \
  | aws s3 cp - "s3://backups/postgres/$(date +%F).dump" \
      --endpoint-url "$STORAGE_ENDPOINT"

Copy a directory with rclone

Configure a generic S3 remote with provider Other. rclone uses path-style addressing by default, and no_check_bucket stops it from trying to create a bucket you already created in the dashboard. Use rclone copy rather than rclone sync for backups: sync deletes objects from the bucket when their files disappear from the source.

Add --checksum so rclone compares size and checksum and does not try to update modification times on existing objects, which it would otherwise try with a server-side copy that the gateway rejects.

Example: an rclone remote from environment variables

export RCLONE_CONFIG_RESILIS_TYPE=s3
export RCLONE_CONFIG_RESILIS_PROVIDER=Other
export RCLONE_CONFIG_RESILIS_ENDPOINT="$STORAGE_ENDPOINT"
export RCLONE_CONFIG_RESILIS_REGION="$STORAGE_REGION"
export RCLONE_CONFIG_RESILIS_ACCESS_KEY_ID="$STORAGE_ACCESS_KEY_ID"
export RCLONE_CONFIG_RESILIS_SECRET_ACCESS_KEY="$STORAGE_SECRET_ACCESS_KEY"
export RCLONE_CONFIG_RESILIS_NO_CHECK_BUCKET=true

rclone copy --checksum /var/backups resilis:backups/server-1

Use restic through rclone

restic’s own S3 backend reads the first part of the URL path as the bucket name, and the Resilis endpoint already has a path, so point restic at the rclone remote above instead. restic protects the repository with a password: keep it somewhere safe, because without it you cannot read the backups.

Example: restic with the rclone remote

export RESTIC_REPOSITORY=rclone:resilis:backups/restic
export RESTIC_PASSWORD_FILE=/etc/restic/password

restic init
restic backup /var/lib/app
restic backup --stdin-from-command --stdin-filename app.dump \
  -- pg_dump --format=custom "$DATABASE_URL"
restic forget --keep-daily 7 --keep-weekly 4 --prune

What to know before you rely on it for backups

Read these before a bucket holds the only copy of anything.

  • You cannot list or restore earlier object versions through the S3 API, or set object lock or lifecycle rules. Nothing on the bucket expires old backups, and a credential with write access can delete them. Keep retention in your backup tool, such as restic forget with --prune, and give each job its own credential.
  • Keep a second copy of critical backups somewhere else. One bucket is one copy.
  • The gateway does not support server-side copy and rejects copy requests with a NotImplemented error before writing anything. A copy inside the bucket, such as aws s3 cp s3://backups/a s3://backups/b, fails, and so does aws s3 mv. To copy or rename, download and upload again, or upload from a local copy with rclone copy --checksum.
  • Test a restore with disposable data before you depend on a job, and repeat it on a schedule.

Restore and check a backup

Restores are downloads, so they count as egress at $0.10/GB. Restore into a scratch database or directory first and check the result.

Example: restore into a scratch target

aws s3 cp "s3://backups/postgres/2026-12-03.dump" - \
    --endpoint-url "$STORAGE_ENDPOINT" \
  | pg_restore --dbname "$SCRATCH_DATABASE_URL"

restic restore latest --target /tmp/restore-check

Can I back up to Resilis object storage with restic or rclone?

rclone speaks S3 and can use a bucket as a generic S3 remote with provider Other, the endpoint from the dashboard and a bucket credential. restic can use the same bucket through its rclone backend. The setups above are examples, not certified integrations, so run a backup and a restore with disposable data first.

Object storage on Resilis

Create a bucket, issue a scoped credential and point an S3 client, the AWS CLI or a backup tool at it. Storage is billed from your runtime credit.

Get started About object storage