Skip to content
Vaulthalla LogoVaulthalla

Managed Upstream Buckets

Let Vaulthalla administer AWS S3, Cloudflare R2 and Backblaze B2 buckets for your vaults - inventory, protection locks, new and adopted buckets, lifecycle rules and safe cleanup.

An upstream provider credential can also administer its AWS S3, Cloudflare R2 or Backblaze B2 account. With provider administration turned on, Vaulthalla lists the account's buckets, creates new buckets for vaults, adopts existing ones, manages its own lifecycle and event rules, and cleans up buckets it created. You choose the vault configuration; Vaulthalla runs the bucket machinery.

AWS S3 Cloudflare R2 Backblaze B2
Bucket inventory, protection locks yes yes yes
Create and adopt buckets, detach, cleanup yes yes yes
Lifecycle rules yes yes only the rule for a vault's file history (others in the Backblaze console)
Event-driven sync yes yes no
Provider versioning yes no yes

Other S3-compatible providers (MinIO, Wasabi, ...) keep working as plain vault storage, within what each bucket supports. Bucket protection locks apply to them too; the rest of this page is AWS S3, Cloudflare R2 and Backblaze B2 only.

Nothing here deletes data by default

Deleting or detaching a vault never deletes its bucket or objects. Deleting an upstream bucket is a separate, explicitly confirmed and audited operation, and only for buckets Vaulthalla created.

One Credential Per Account

Provider administration extends the upstream provider credential you already use. It does not need extra cloud identities: one access-key pair per account does everything. Vaulthalla splits authority between people with its own admin.upstream permissions (see Permissions).

Turn it on for an existing credential:

1vh upstream admin enable <api-key>2vh upstream admin status <api-key> --probe

status --probe checks what the credential can do without changing anything and lists each capability as available or missing, with the permission to grant. A missing capability doesn't block the rest: a credential that can list and create buckets but not create queues still manages buckets, and event-driven sync reports exactly what is missing.

In the web console: Credentials → the credential → Provider administration.

AWS S3

The credential's IAM identity needs, on the buckets Vaulthalla manages:

  • s3:ListAllMyBuckets, s3:CreateBucket, s3:DeleteBucket, s3:GetBucketLocation, s3:ListBucket, s3:ListBucketVersions, s3:GetBucketVersioning, s3:GetBucketObjectLockConfiguration, s3:GetLifecycleConfiguration, s3:PutLifecycleConfiguration, s3:GetBucketNotification, s3:PutBucketNotification, s3:DeleteObject, s3:DeleteObjectVersion, plus the object permissions plain vault storage already needs.
  • For event-driven sync, on queues named vaulthalla-* in the same account (arn:aws:sqs:*:<account>:vaulthalla-*): sqs:CreateQueue, sqs:GetQueueUrl, sqs:GetQueueAttributes, sqs:SetQueueAttributes, sqs:ReceiveMessage, sqs:DeleteMessage, sqs:ChangeMessageVisibility, sqs:DeleteQueue, and sqs:ListQueues (on *).
  • For provider versioning, on the vault's bucket: s3:PutBucketVersioning (turn versioning on, or suspend it) and s3:GetObjectVersion (read an old version's metadata, copy it back or download it during a restore), on top of s3:GetBucketVersioning, s3:ListBucketVersions and the lifecycle permissions above. They are checked when provider versioning is used, so status --probe lists them without testing them. s3:GetObjectVersionAttributes isn't used.

The same credential sets the queue's resource policy that lets Amazon S3 publish to it; no second IAM principal is involved. Vaulthalla reads the account ID with STS GetCallerIdentity, which needs no permission.

Cloudflare R2

R2's S3-compatible credentials (access key ID and secret) cover listing, creating and deleting buckets and lifecycle rules. R2 event notifications and Cloudflare Queues are managed through Cloudflare's account API, which needs an API token instead: an R2 secret access key is a hash of a token, not the token, so it can't sign those requests.

For event-driven sync, create one Cloudflare API token for the account with Account › Queues: Edit and Account › Workers R2 Storage: Edit, and store it on the same credential:

1vh upstream admin enable <api-key> --provider-token

The token is asked for at a hidden prompt, sealed like the S3 secret, and never shown again (the console only says whether one is stored). --clear-provider-token removes it. The account ID comes from the R2 endpoint (https://<account-id>.r2.cloudflarestorage.com). R2 signs every request with region auto; location hints such as wnam are only used when creating a bucket.

Backblaze B2

Vaulthalla administers Backblaze B2 through B2's S3-compatible API, with the same application key the vault's storage uses. The credential's provider must be backblaze-b2 and its endpoint the account's S3 endpoint, https://s3.<region>.backblazeb2.com (for example https://s3.us-west-004.backblazeb2.com; Backblaze shows it on each bucket as Endpoint).

1vh api-key create b2-admin --provider backblaze-b2 \2  --access <keyID> --secret <applicationKey> \3  --endpoint https://s3.us-west-004.backblazeb2.com --region us-west-0044vh upstream admin enable b2-admin5vh upstream buckets b2-admin

The application key:

  • must be a standard application key. Backblaze's S3-compatible API doesn't accept the account's master application key.
  • must have access to all buckets. A key restricted to one bucket can't create buckets, and can't list the account without the listAllBucketNames capability; status --probe then reports buckets.list as missing.
  • needs listBuckets, readBuckets, writeBuckets and deleteBuckets for bucket administration and readBucketRetentions to read object lock, on top of the file capabilities (listFiles, readFiles, writeFiles, deleteFiles) vault storage needs. A read-write key for all buckets created in the Backblaze console has them. listBuckets and writeBuckets are also what reading and setting a vault's history rule takes (Backblaze's native API, with the same key).

What is different on B2:

  • Bucket names are shared by every Backblaze account, have 6 to 63 characters, and can't start with b2-. Vaulthalla checks the length and the prefix before it sends anything. A name another account already holds is reported as taken: choose another name, or let Vaulthalla generate one (--generate-bucket).
  • Region. A Backblaze account keeps its buckets in one region, the one in the endpoint. New buckets are created there; --region is not needed and any other region is refused.
  • New buckets are private (allPrivate).
  • Versions and lifecycle rules. Every B2 bucket keeps object versions and that can't be switched off, so inspect always shows versioning enabled, and cleanup deletes every version before it deletes a bucket. How long old versions stay is a lifecycle rule, which Vaulthalla reads and writes through Backblaze's native API: inspect lists every rule (Vaulthalla's marked), and the vault's recovery mode sets Vaulthalla's own. A bucket Vaulthalla creates keeps only the latest version; --mode provider-versioning --retention 30d keeps 30 days. Other rules stay with you: vh upstream lifecycle and --abort-multipart-days are refused for a B2 credential, so set them in the Backblaze console (bucket → Lifecycle Settings). Every rule Vaulthalla didn't write is kept as it is. Don't add a rule that removes old versions under .vaulthalla/: a vault with opaque storage on B2 publishes its manifest as versions there (see Providers Without Conditional Writes); status warns when one does.
  • Event-driven sync is not available: B2's event notifications aren't reachable through its S3-compatible API. B2 vaults sync on their interval.
  • Account. Vaulthalla identifies a B2 bucket by the region endpoint and its name (names are unique across Backblaze), so the inventory shows the endpoint host as the account. Backblaze allows 100 buckets per account unless its support raises the limit.

Bucket Inventory

1vh upstream buckets <api-key>2vh upstream buckets <api-key> --state unmanaged

The inventory is one account-level ListBuckets page merged with what Vaulthalla knows. It makes no bucket-level or object calls. Each bucket has one state:

State Meaning
managed Vaulthalla created it for a vault.
adopted An existing bucket an administrator explicitly associated with a vault.
unmanaged Discovered in the account, not controlled by Vaulthalla.
protected Locked: excluded from every Vaulthalla operation (see below). The lock wins over the other states.

Use --filter <text> to match names, and --page-token to continue a long listing.

Protection Locks

A protected bucket is a hard exclusion. Vaulthalla will not probe it, inventory its objects, adopt it, bind a vault to it, change its lifecycle or event rules, read or write it during sync, empty it or delete it. Scheduled syncs, retries and work already in flight stop at their next request to it; a vault already bound to it stalls with a "bucket is protected" error until the lock is removed. Account-level listings still show its name.

1vh upstream protect <api-key> <bucket> --reason "production backups, not for Vaulthalla"2vh upstream unprotect <api-key> <bucket>
  • The lock belongs to the bucket itself (provider, account and bucket name), not to the credential. Deleting and re-creating the credential keeps it, and any other credential for the same account sees it.
  • The provider and account come from the credential's endpoint, not its label: a credential for an ….r2.cloudflarestorage.com, ….amazonaws.com or s3.<region>.backblazeb2.com endpoint is treated as Cloudflare R2, AWS S3 or Backblaze B2 whatever provider it was saved with, so a lock can't be sidestepped by relabelling a key. New credentials whose provider contradicts their endpoint are refused.
  • Locks work for any provider, including ones without administration support.
  • Bucket names are checked before they are used anywhere upstream (3–63 characters of a-z 0-9 . -; on Backblaze B2 at least 6, and not starting with b2-); a name like x/../prod is refused. Buckets with older, non-conforming names can still be locked.
  • Removing a lock needs the separate admin.upstream.unprotect permission, the right to use the credential (consume), and an explicit confirmation (--yes for scripts). Both directions are recorded in the audit log with who, when and the reason.
  • Locks are kept in the database and loaded before the server makes any upstream request; if they can't be loaded, the server doesn't start.

Create A Vault With A New Bucket

1vh vault create media --s3 --api-key aws-admin --bucket-mode create --generate-bucket --region us-east-22vh vault create media --s3 --api-key r2-admin --bucket-mode create --bucket vh-media --events3vh vault create media --s3 --api-key b2-admin --bucket-mode create --bucket acme-media-vault

In the web console, New vault offers Create a new bucket for administrative credentials, with Generate a name, the region or location hint, and optional advanced settings (incomplete-upload cleanup, event-driven sync). For a Backblaze B2 credential it asks for the name only: the region is the account's, and lifecycle rules and events stay with Backblaze.

Creating never takes over an existing bucket:

  1. The name must not exist (a HeadBucket 404). An existing bucket is refused: adopt it instead. A name that belongs to another account (AWS and Backblaze B2 share bucket names across all accounts) is reported as taken, since there is nothing to adopt: choose another name.
  2. The provider must create it. "Already exists" or "already owned by you" is refused and nothing changes.
  3. The new bucket must be empty, with no old object versions or delete markers (Backblaze B2 hide markers) either. If it isn't, creation stops, the bucket is left as it is and marked failed.

Only then is the bucket recorded as one Vaulthalla created, and the vault created and bound. A failure before that point (a timeout, a throttled request) leaves no claim on the name at all. If anything fails after the bucket was created, an empty bucket created by this attempt is removed again; anything else is left untouched and marked failed. Retrying with the same name resumes only a bucket that an earlier attempt really created and that is still empty; a bucket someone else created under that name in the meantime is refused like any existing bucket. Two creations racing for one name can't both win.

One race remains on AWS us-east-1, where CreateBucket also answers "created" for a bucket the account already owns: an empty bucket that someone in the same account creates in the milliseconds between Vaulthalla's check and its create can't be told apart from a new one. A bucket that already holds anything is always refused.

Adopt An Existing Bucket

Adoption associates a bucket that already exists, with its data, with a new vault. It is always explicit.

1vh upstream adopt-check <api-key> <bucket>2vh vault create archive --s3 --api-key aws-admin --bucket <bucket> --bucket-mode adopt

adopt-check is a read-only admission check: it lists up to 10,000 keys and reads the metadata (not the bodies) of a small sample. It reports object counts and bytes, whether objects are Vaulthalla-encrypted or plaintext, versioning and object lock, and whether the bucket already holds a Vaulthalla manifest from another vault. It refuses protected buckets and buckets another vault already uses.

Creating the vault then asks for confirmation (--yes for scripts; the console shows the report). Nothing in the bucket is deleted, overwritten or converted: plaintext objects are imported as vault files and encrypted locally; whether new uploads to the bucket are encrypted follows the vault's upstream encryption setting, and the usual encryption waiver is recorded. When event-driven sync is requested, the subscription is created before the first full listing, so changes made during the listing aren't lost.

Lifecycle Rules

1vh upstream inspect <api-key> <bucket>2vh upstream lifecycle <api-key> <bucket> --abort-multipart-days 73vh upstream lifecycle <api-key> <bucket> --clear

inspect shows the bucket's region, versioning, object lock, lifecycle rules and event rules, marking which ones are Vaulthalla's. Vaulthalla owns one lifecycle rule, vaulthalla-managed, on managed and adopted buckets, and preserves every other rule unchanged. A vault with provider versioning also gets vaulthalla-manifest-versions, which expires old versions of Vaulthalla's own index under .vaulthalla/ after one day, and its retention is the NoncurrentDays of vaulthalla-managed. For those vaults, change the retention with vh vault recovery set --retention, which asks before history is shortened.

Option AWS S3 Cloudflare R2
--abort-multipart-days N (incomplete multipart uploads) yes yes
--expire-days N (delete current objects after N days) yes, destructive yes, destructive
--expire-noncurrent-days N (delete old versions) yes, destructive not offered
--prefix P yes yes

Expiration rules delete data, so they need explicit confirmation (--yes). Value 0 removes a setting. New R2 buckets come with Cloudflare's default multipart-abort rule; it is kept as a foreign rule.

On Backblaze B2, inspect lists the bucket's lifecycle rules (read through Backblaze's native API) and shows event rules as not readable. Vaulthalla writes only the rule for a vault's file history there (vh vault recovery set); vh upstream lifecycle is refused for a B2 credential. Manage other rules in the Backblaze console.

Vault Deletion, Detach And Cleanup

Deleting a vault (Deleting And Restoring Vaults) leaves its bucket and objects in place unless you chose the existing opt-in upstream object purge. The bucket stays managed or adopted with no vault. That purge is refused for an adopted bucket: it held data before the vault existed (often other applications'), and the purge would delete all of it. Keep the upstream data, detach the bucket, and clean it up with the provider.

Detach gives a bucket that no vault uses back to you: Vaulthalla removes its own event rules and its vaulthalla-managed lifecycle rule, and the bucket becomes unmanaged. Data is untouched. Detach doesn't change the bucket's versioning and, today, leaves a vaulthalla-manifest-versions rule in place: remove it with the provider if you no longer want it. On Backblaze B2 detach removes Vaulthalla's rules (and their record in the bucket info), so the bucket keeps every version again, as B2 buckets do.

1vh upstream detach <api-key> <bucket>

Cleanup deletes a bucket Vaulthalla created, with every object version in it:

1vh upstream cleanup <api-key> <bucket>

It first prints a preflight: object, version and delete-marker counts, bytes, versioning and object lock, sample keys and anything that blocks it. It is refused for protected buckets, adopted or unmanaged buckets, buckets any vault (including one pending deletion) is bound to, and buckets with a live event subscription. To go ahead you type the bucket name (or pass the preflight's --confirm-token, valid for 10 minutes). Right before deleting, every check runs again, and the cleanup then holds the bucket: an adoption, a create retry or a detach attempted meanwhile is refused, and a lock set while it runs stops it at the next round. Object-lock and retention rules are the provider's to enforce: objects it refuses to delete are reported, and the result is partial, never deleted. A provider error part way is also partial, with what was already deleted in the audit log; the bucket is left marked failed and a new preflight and cleanup continue. Large buckets are deleted in rounds; run the command again to continue. Nothing is ever purged because a vault creation or a sync failed.

Permissions

Provider administration uses its own admin permission module, admin.upstream, on top of the credential permissions (admin.keys.api.*) every operation also needs for the key it uses:

Permission Allows Built-in roles
admin.upstream.view inventory, inspect, event status, audit log super_admin, admin, platform_operator, security_admin, auditor, vault_admin
admin.upstream.configure turn administration on or off, lifecycle rules, event subscriptions and repair super_admin, admin, platform_operator
admin.upstream.provision create managed buckets, adopt buckets super_admin, admin, platform_operator
admin.upstream.protect lock a bucket super_admin, admin, platform_operator, security_admin
admin.upstream.unprotect remove a lock super_admin
admin.upstream.destroy detach and clean up buckets super_admin

Grant them to custom roles with vh role admin update <role> --allow-upstream-<name> or the console's role editor. The CLI and the web console run the same operations with the same checks.

Audit Log

1vh upstream audit2vh upstream audit --bucket <bucket>

Every lock and unlock, creation, adoption, lifecycle change, event subscription change, detach and cleanup, and refusals that matter (protected bucket, name collision), is recorded with the account, bucket, credential, vault, who did it and the outcome. Reading it needs admin.upstream.view, and shows only entries for credentials you may view; entries whose credential was deleted are shown to full administrators only.