Skip to content
Vaulthalla LogoVaulthalla

S3 And R2 Vaults

Create and operate upstream-backed Vaulthalla vaults using AWS S3, Cloudflare R2, or compatible provider buckets.

S3/R2 vaults use an upstream S3/R2 bucket as Vaulthalla storage. Vaulthalla connects to the external provider bucket with an upstream provider credential, stores or indexes file bodies according to the vault sync policy, and keeps local metadata in PostgreSQL.

Upstream storage, not downstream client access

This page is about upstream S3/R2 storage: the external provider bucket Vaulthalla uses as a vault backend. If you want AWS CLI, rclone, MinIO mc, SDKs, or apps to talk to Vaulthalla using the S3 protocol, use S3 Gateway instead.

Upstream Versus Downstream S3

Concept Upstream S3/R2 Vault Downstream S3 Gateway
Who connects? Vaulthalla -> provider S3 client -> Vaulthalla
Credential type vh api-key upstream provider credential vh s3-gateway creds inbound gateway credential
Bucket meaning External AWS/R2 bucket Vaulthalla gateway bucket bound to a vault
Encryption Upstream object encryption setting Client-visible S3 protocol; Vaulthalla storage encryption still applies
Sync Controls provider side effects Gateway mutates Vaulthalla; sync owns upstream side effects

Use an upstream S3/R2 vault when Vaulthalla should store vault data in AWS S3, Cloudflare R2, or another compatible provider. Use S3 Gateway when downstream clients should access Vaulthalla through the S3 protocol.

Upstream Provider Credentials

Let Vaulthalla manage the bucket

With an AWS S3, Cloudflare R2 or Backblaze B2 credential, Vaulthalla can also create the bucket for you, adopt an existing one, protect buckets it must never touch, and (AWS, R2) sync from provider events instead of scans. On Backblaze B2, whose buckets always keep every version, it also sets how long old versions stay from the vault's recovery mode: a bucket it creates keeps only the latest one. See Managed Upstream Buckets and Event-Driven Sync.

Create an upstream provider credential before creating the vault:

1vh api-key create r2-main \2  --access <access-key> \3  --secret <secret-key> \4  --provider cloudflare-r2 \5  --endpoint https://<account-id>.r2.cloudflarestorage.com

AWS-style example:

1vh api-key create aws-main \2  --access <access-key> \3  --secret <secret-key> \4  --provider aws \5  --endpoint https://s3.amazonaws.com \6  --region us-east-1

The endpoint is required. The default region is auto, which is suitable for Cloudflare R2 and some compatible providers.

Vaulthalla validates credentials during API key creation. Some providers return AccessDenied for broad bucket-list checks even when the credentials are valid for the intended bucket, so bucket-specific permissions should still be tested with a vault dry-run.

Minimum Upstream Bucket Permissions

Grant only the upstream bucket operations your sync policy needs. Typical S3/R2 vault operation may require:

  • List bucket for reconcile and some remote-index refresh paths.
  • Head/Get object for remote metadata and downloads.
  • Put object for uploads and manifest publishes.
  • Delete object when deletes are part of the sync policy.
  • Copy object for provider-side copy paths where used.

Use request budgets and dry-runs before enabling broad remote operations on large upstream buckets.

Create An Upstream-Backed Vault

1vh vault create archive \2  --s3 \3  --api-key r2-main \4  --bucket vaulthalla-archive \5  --sync-strategy cache \6  --on-sync-conflict keep_local \7  --encrypt

Useful options:

Option Purpose
--api-key Upstream provider credential name or id.
--bucket Upstream S3/R2 bucket name.
--storage-tier or --storage-class Provider storage class such as standard, standard_ia, or infrequent_access.
--sync-strategy cache, sync, or mirror. Without it, the vault gets vaults.s3.default_remote_sync_strategy from config.yaml (cache).
--on-sync-conflict S3 conflict policy: keep_local, keep_remote, keep_newest, or ask. Without it, the vault gets vaults.s3.default_remote_conflict_policy (ask: a file changed on both sides waits for vh sync resolve or the console; see Sync).
--encrypt Encrypt upstream object bodies before upload.
--no-encrypt Store upstream object bodies without Vaulthalla encryption.
--interval Sync interval.
--owner Create for a specific owner where permitted.

Attaching A Bucket To A Local Vault

A vault created as a local vault can be given a bucket later. It stays the same vault: its ID, keys, permissions, shares and files are kept, and it becomes an S3/R2 vault with opaque storage in place.

1vh vault remote attach finance --api-key r2-main --bucket finance-vault2vh vault remote status finance

Before anything is uploaded, Vaulthalla checks that the attach can succeed and refuses otherwise, with the vault unchanged:

  • The bucket is empty and unused. Every object version and delete marker counts, and no other vault may use the bucket with that API key. The bucket must not have a protection lock.
  • The bucket can hold the vault's manifest. It is probed the way vh vault storage probe probes a vault's bucket (Providers Without Conditional Writes).
  • The vault holds no content in the legacy format. vh vault format status <vault> shows what is left; the background conversion finishes first.
  • The vault has recovery material that doesn't depend on this server: a recovery recipient (vh vault keys recipient add, which also works on a local vault) or an export of the current key (vh vault keys export). See Recovery Recipients.
  • No key rotation or key salvage is running, and this server holds every key version the vault's content uses.

The upload then runs in the background and continues after a restart. The vault stays local and in use the whole time: files that change while they are uploaded are sent again (up to vaults.remote_attach.max_passes times, see Configuration). Every object is verified, a sample is read back and decrypted, and the vault's encrypted manifest is published and read back from the bucket. Only then does the vault switch to its bucket, in one step. It starts in the cache sync strategy with every file still on disk, so nothing is downloaded, and anything that changed at the last moment uploads with its first sync pass.

vh vault remote status <vault> shows the state, the progress (files and bytes sent, the current rate and the time left when known), the cost estimate and the last error. The cost is checked against the price budget before the upload starts; when the provider can't be priced, start the attach with --accept-unpriced.

If something fails before the switch, the vault is still a local vault and nothing of it changed. Run the same command again, with the same API key and bucket, to resume; what was already uploaded and verified is kept. To give up instead:

1vh vault remote abort finance --confirm finance

An abort deletes what the attach uploaded, each object by the version the attach recorded, and frees the bucket. It never deletes anything the attach didn't write. An attach can't be aborted once the vault has switched to its bucket.

What to know:

  • A key rotation asked for during an attach waits and starts when the attach has ended.
  • Snapshots and local versions taken before the attach stay local recovery points. The bucket's own history starts with the attach.
  • A vault's recovery recipients carry over: their key envelopes are copied into the bucket before the switch.
  • An S3 gateway bucket bound to the vault keeps working and serves the vault as a cached remote from then on.
  • Attaching a bucket is decided by a person: it isn't available to agents.
  • The web console has the same flow under Vault → Settings → Remote storage: choose a credential and an empty bucket, follow the progress, and abort or resume from there.

Detaching A Bucket From A Vault

An S3/R2 vault can be made a local vault again, keeping a full copy on this server. It stays the same vault: its ID, keys, permissions, shares and files are kept.

1vh vault remote detach finance --confirm finance2vh vault remote status finance

The detach checks first and refuses otherwise, with the vault unchanged: no attach, bucket layout migration, key rotation or key salvage may be running, the vault holds no content in the legacy format, this server holds every key version its files use, event-driven sync is off, and no sync conflict is open (resolve them first, so no version in the bucket is left undecided).

Then, in the background and while the vault stays an S3 vault that syncs as before:

  • every file without a copy on this server is fetched from the bucket (each fetch is checked against the price budget),
  • every local copy is authenticated against the generation the catalog records, and
  • every recovery envelope of the vault's recovery recipients is copied from the bucket into the server's database, where a local vault keeps them. A detach never leaves one behind: if an envelope can't be read from the bucket, the detach stops and the vault stays an S3 vault.

Files that change meanwhile are checked again. Only when everything is held and verified does the vault switch, in one step, to a local vault. The bucket and every object in it are left as they are: a detach never writes to or deletes from the bucket. Deleting the bucket, if you want to, is a separate step.

If something fails before the switch, the vault is still an S3 vault. Run the same command again to resume, or abort it with vh vault remote abort finance --confirm finance; the files fetched so far stay on this server as cached copies.

What to know:

  • Earlier versions whose contents only the bucket holds (released from this server once the provider kept them) stay in the bucket's history and can't be restored from this server afterwards. Trashed files without a local copy stay in the bucket too. vh vault remote status counts both before the switch.
  • Provider versioning as the vault's recovery mode becomes local snapshots; queued uploads of earlier versions are dropped (the versions stay local recovery points).
  • An S3 gateway bucket bound to the vault serves it as a local bucket from then on.
  • Detaching is decided by a person: it isn't available to agents. The web console offers it under Vault → Settings → Remote storage, with a step-up confirmation.

Remote Access

An S3/R2 vault's access to its bucket can be limited, for example while the provider is in maintenance or while an account can't take new writes:

1vh vault remote access finance --set read-only --reason "provider maintenance"2vh vault remote access finance --set none3vh vault remote access finance --set full
Access What the vault does
full Everything, as usual.
read-only Files are read and fetched from the bucket as before, but nothing is uploaded, deleted or published there. The vault's sync passes are skipped (recorded as skipped: remote read-only); changes made on this server are kept and go up with the first pass once access is full again. A key rotation waits.
none No request goes to the bucket at all. Files with a copy on this server keep working; files without one can't be opened (remote_unavailable).

vh vault remote status <vault> shows the vault's access, why and who set it; vh status and the health page show a read-only or unavailable remote as degraded. Setting it needs the same permissions as attaching a bucket, and it isn't available to agents. A vault keeps its access across restarts. Detaching a read-only vault works (a detach only reads the bucket), and the setting goes with the vault's bucket.

Upstream Encryption

New S3/R2 vaults should normally use upstream encryption. With it enabled, a new vault uses opaque storage (opaque_v1): each file is one encrypted object named by a random id, with no metadata headers, and names, folders and history live in an encrypted manifest in the same bucket (.vaulthalla/). Your storage provider only ever sees encrypted, opaquely named objects. It can't see your file names, folders or contents. It can see how many objects you store, their sizes and when they change (what remains visible).

  • The vault's keys stay on your server. For recovery that doesn't depend on this server, create a recovery kit and enroll it on the vault (vh vault keys recipient add): every key version is then wrapped to it in the vault's own bucket, and vh vault recover can rebuild the vault from the bucket and the kit on another server. A vault with neither a recipient nor a current key export shows as degraded (recovery_material_missing). See Recovery Recipients.
  • Don't delete or edit objects under o/ or .vaulthalla/ in the bucket yourself, and keep provider versioning on if you can: an older manifest the provider kept is what a restore falls back to when the newest one is damaged.
  • Vaults created before release 1.22 keep the earlier path_v0 layout, where each object is named after the file's path and carries encryption metadata: file and folder names are visible to your storage provider. They stay that way until you migrate them with vh vault migrate-layout <vault>, which re-seals every object and version under opaque ids and deletes the old path-named objects only after a waiting period and your confirmation (Migrating A Vault To Opaque Storage).

With --no-encrypt, object payloads written upstream are plaintext from Vaulthalla's perspective. This can be useful for interoperability, but it changes the risk model. See Encryption before disabling upstream encryption.

When changing encryption behavior on an existing upstream bucket, Vaulthalla may require explicit waivers:

1vh vault update archive --no-encrypt --accept-decryption-waiver2vh vault update archive --encrypt --accept-overwrite-waiver

Read the prompt and understand whether existing objects will remain as-is, be overwritten, or need a planned migration.

Providers Without Conditional Writes

Some writes must never overwrite another writer's object: the encrypted manifest's root, its segments, recovery envelopes and the file index. Vaulthalla sends those with conditional headers (If-None-Match, If-Match), which AWS S3 and Cloudflare R2 honour. Some S3-compatible providers don't: Backblaze B2 answers them with 501 NotImplemented.

Vaulthalla therefore probes each bucket once, when a vault is created on it or moved to it (an older vault is probed on its first use), and records what it supports:

1vh vault storage probe <vault>

The probe writes a few bytes under .vaulthalla/probe/ (about ten requests) and deletes exactly the versions it wrote. It reports whether conditional writes are honoured, rejected or silently ignored, whether the bucket keeps object versions, and whether a read pinned to an ETag (If-Match on GET) is honoured.

On a bucket without conditional writes that keeps object versions (Backblaze B2, whose buckets keep every version by default), the probe reports version_log:

Vault What happens
Without upstream encryption (--no-encrypt) Works. Its index is written without conditions; one server writes it, and only its current version is ever read (so a whole-bucket history rule is safe for it).
Encrypting, created before release 1.22 (path_v0) Works, as before: its index is written without conditions. It can be moved to opaque storage there (vh vault migrate-layout).
Encrypting, opaque storage (opaque_v1) Works. The encrypted manifest's root is written as a new version of .vaulthalla/root on each publish, and the server lists the root's versions once to confirm its own version is the one that counts. Restarts, vh vault recover, recovery recipients and key rotation work as on any other bucket.

What changes for an opaque vault on such a bucket:

  • One request more per publish: a pass that changes the vault costs one version listing of .vaulthalla/root on top of the changed manifest segments and the root (Backblaze bills listings as class C transactions). A pass that changes nothing still costs one HEAD.
  • Keep every version under .vaulthalla/. The server deletes the root versions it no longer needs itself (it keeps the current root, its two predecessors and a week of history) and every version of a manifest segment once no recent root uses it. Don't set a lifecycle rule that removes old versions under .vaulthalla/ (in Backblaze, "Keep only the last version of the file" on the whole bucket, or any rule with daysFromHidingToDeleting whose prefix reaches .vaulthalla/): it could remove the current root while a stray version from a crashed write sits above it, and the vault then refuses its manifest (fork) instead of reading the wrong one; when it removes an older version between roots, the server reads the newest root and reports a gap in the manifest's history. The rule Vaulthalla itself sets on a Backblaze B2 bucket for the vault's recovery mode covers only o/ (the files) for these vaults, and vh vault recovery status --refresh warns about any other rule that reaches .vaulthalla/.
  • One server per vault. A vault restored elsewhere with vh vault recover takes the vault over: the old server, if it still runs, stops publishing the vault's manifest and alerts its operators (manifest_superseded).
  • New alerts (operator notifications, and the vault's sync stalls until someone looks): manifest_order_violation (the provider listed the root's versions in a different order than before, so the server can no longer tell which root counts), manifest_superseded (above), manifest_publish_mode_mismatch (another server published the vault's root in the other mode). A publish whose own root version doesn't appear in the listing within about 15 seconds stays pending (listing_lag in the stall reason) and the next pass completes it.

A bucket that neither honours conditional writes nor keeps versions is insufficient: creating an encrypting vault on it is refused (bucket_capability_insufficient), as are moving one there and a layout migration onto it. An existing opaque vault there keeps uploading files, but its sync stops with manifest_publish_unsupported and vh status lists it as degraded. Turn versioning on for the bucket, then run vh vault storage probe <vault>.

If a bucket that was probed as supporting conditional writes later refuses one (the endpoint, a proxy in front of it or the provider changed), Vaulthalla never falls back to writing without the condition: the vault's sync stops with bucket_capability_changed, the operators are notified once, and it stays stopped until you check the endpoint and run vh vault storage probe <vault> again. Changing a credential's provider or endpoint (vh api-key update) makes every vault using it probe again.

Sync Strategies

Strategy Behavior
cache Keep a local cache and index remote-only objects without downloading every body up front. Bodies are fetched as needed.
sync Two-way synchronization between local and remote state.
mirror Local-to-remote mirror behavior. Remote changes are not treated as authoritative local changes.

See Sync before enabling a strategy on an existing upstream bucket.

Storage Tiers

Use storage tier options to request a provider storage class for uploaded objects. Examples include AWS standard or standard_ia, and Cloudflare R2 standard or infrequent_access.

Archive-tier objects may be indexed but skipped for body download until restored by the provider. Sync dry-run output reports archive-tier download skips when they are detected.

Vault Web Console Settings

The Vaults page exposes the same major upstream S3/R2 settings:

  • Upstream provider API key and upstream bucket.
  • Storage tier.
  • Sync strategy and conflict policy.
  • Sync interval.
  • Upstream encryption.
  • Request budget preset or custom limits.
  • Maximum remote-index age.
  • Sync enabled state.

Use the web console for interactive setup and vh vault sync info <vault> for a scriptable view of the resulting policy.

Expose This Vault Through S3 Gateway

To let downstream S3 clients access an S3/R2 vault through Vaulthalla, bind the vault as a remote-backed gateway bucket:

1vh s3-gateway bucket bind archive --vault archive --mode remote_cache

See S3 Gateway Buckets for local and remote-backed gateway bucket setup.