Short answer: when comparing AWS S3, Wasabi, and Backblaze B2 for user document storage, define the tenant boundary before comparing object-store features. For a B2B SaaS receipt service, the original file should be addressed by an immutable tenant-scoped key, written through a policy that rejects a missing tenant, and paired with an audit record before the upload is considered complete. The store is replaceable; an ambiguous ownership record is not.
The boundary comes first.
The object key is evidence, not permission.
The comparison among AWS S3, Wasabi, and Backblaze B2 matters after that constraint is explicit. Multipart behavior, lifecycle controls, encryption options, object-version semantics, and recovery workflows differ, but none of those features can repair an application that lets one tenant resolve another tenant's object.
What must tenant isolation actually protect?
A receipt has at least two identities: the business object that the application understands and the immutable bytes that an auditor may later inspect. Keep them separate. A database row can carry tenant_id, receipt ID, content type, digest, object key, uploader, and timestamps; the object key should contain a server-generated receipt ID rather than an invoice number supplied by a browser.
For example, an internal key might be receipts/acme-42/2026/01/01/01J.... That path is useful for operations, but it is not an authorization mechanism. Every read still needs a tenant check against the database row, followed by an object-store request made with server credentials or a narrowly scoped signed request. A path prefix is a fence marker, not a lock.
I use one decision rule here: a request is allowed only when the authenticated principal, the database row, and the storage key independently agree on the tenant. If any one of the three is absent, the request fails closed. This looks repetitive, and it is; payment and ledger systems taught me that duplicated assertions are cheaper than an audit that cannot explain ownership.
The receipt workflow should therefore produce a small state machine: pending, stored, verified, or rejected. The digest is calculated from the original bytes, the object is written, a head or metadata check confirms the expected length and digest where supported, and only then does the database transition to verified. An audit event records the actor, tenant, receipt ID, operation, result, and correlation ID.
How should the upload enforce the boundary?
Do not let a client choose an arbitrary destination. Let it send bytes or a constrained upload request to an API that has already derived the tenant from authentication. The service owns the key, the maximum size, the allowed media types, and the metadata. The following Go example is deliberately based on a small interface; it makes the policy testable without binding the domain code to one storage provider.
package receipts
import (
"bytes"
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
)
type ObjectWriter interface {
Put(ctx context.Context, key string, body io.Reader, size int64, digest string) error
}
type AuditLog interface {
Record(ctx context.Context, tenantID, receiptID, action, result string) error
}
func Store(ctx context.Context, writer ObjectWriter, audit AuditLog, tenantID, receiptID string, body io.Reader, size int64) (string, error) {
if tenantID == "" || receiptID == "" || size <= 0 || size > 25*1024*1024 {
return "", fmt.Errorf("invalid receipt request")
}
data, err := io.ReadAll(io.LimitReader(body, 25*1024*1024+1))
if err != nil {
return "", fmt.Errorf("read receipt: %w", err)
}
if int64(len(data)) != size || int64(len(data)) > 25*1024*1024 {
return "", fmt.Errorf("receipt size mismatch")
}
sum := sha256.Sum256(data)
digest := hex.EncodeToString(sum[:])
key := fmt.Sprintf("receipts/%s/%s", tenantID, receiptID)
if err := writer.Put(ctx, key, bytes.NewReader(data), size, digest); err != nil {
_ = audit.Record(ctx, tenantID, receiptID, "store", "rejected")
return "", fmt.Errorf("store receipt: %w", err)
}
if err := audit.Record(ctx, tenantID, receiptID, "store", "accepted"); err != nil {
return "", fmt.Errorf("write audit event: %w", err)
}
return key, nil
}
The important contract is the digest and the tenant-derived key, not the SDK call hidden behind ObjectWriter. In production, stream large files into a digesting writer instead of buffering them. The example's 25 MiB limit is an application policy, not a universal receipt limit; choose it from the domain and test the rejection boundary.
Idempotency belongs beside this policy. A retry with the same tenant and client request ID must resolve to the same receipt record, digest, and object key. Do not create a fresh object on every timeout and then ask reconciliation to guess which copy is authoritative. Store the idempotency key with the tenant ID under a unique constraint, and make a replay return the recorded result. This is an exactly-once mindset implemented over at-least-once transport.
What should user document storage optimize for?
The three commonly compared services are all object-storage choices, but their operational surfaces are not interchangeable. AWS S3 documents multipart upload as a sequence of part uploads followed by completion; this is valuable for large receipts, while incomplete multipart uploads need an explicit cleanup policy. Wasabi and Backblaze B2 expose S3-compatible interfaces for many workflows, but compatibility does not mean identical lifecycle, retention, replication, or billing behavior. Read the current service documentation for the exact control available in the region and account configuration.
The limitation is practical: an S3-compatible API can reduce adapter work while still leaving retention, lifecycle, and recovery semantics different enough to invalidate an untested assumption. A team that needs provider-specific retention or a particular restore workflow may accept more integration code in exchange for that control; a small team may reasonably prefer a narrower feature set that it can operate and verify.
| Decision area | What to verify | Why it affects tenant isolation |
|---|---|---|
| Multipart uploads | Part limits, completion, abort cleanup | Orphaned parts can retain tenant data outside the expected object inventory |
| Versioning and retention | Delete markers, object lock, retention scope | A delete request may not remove the bytes an auditor can still retrieve |
| Credentials | Role or key scope, signed-request constraints | Broad credentials turn a path mistake into cross-tenant access |
| Lifecycle rules | Prefix or tag selection and timing | A rule that matches too broadly can expire another tenant's evidence |
| Restore behavior | Listing, restore latency, checksum verification | Recovery must preserve the tenant and audit mapping, not merely the file |
Compare AWS S3, Wasabi, and Backblaze B2 against this matrix rather than against a single headline feature. AWS S3's multipart documentation is a useful reference for the upload protocol, but protocol support alone does not answer who may complete an upload. A provider's S3-compatible endpoint may reduce adapter work while leaving differences in retention and lifecycle semantics that your tests must expose. The adapter boundary should therefore return domain results such as stored, already_stored, and retryable, not leak provider-specific success assumptions into receipt logic.
Prices should not drive the first decision. A less expensive byte can still be the wrong choice if the team cannot inspect incomplete uploads, prove a deletion policy, or restore a single tenant without restoring an entire bucket.
Operations decides.
What does an auditable recovery test look like?
A backup statement is not a recovery procedure. Seed a test tenant with a known receipt, a duplicate filename, a deleted database row, and an object whose digest is recorded. Then exercise a restore into an isolated namespace. The expected result is precise: the original bytes hash to the recorded digest, the restored row retains its tenant ID, the audit trail shows who initiated recovery, and a user from another tenant cannot enumerate or fetch the restored key.
Keep the test data boring and the assertions sharp. Test a missing tenant claim, a mismatched receipt owner, a reused idempotency key from a different tenant, an expired signed URL, and a multipart upload abandoned before completion. The last case is easy to neglect because no completed object appears in a normal listing; operational inventory and provider metrics must account for it.
Observability should carry tenant ID only where the logging policy permits it, and it should never log receipt contents or credentials. A correlation ID connects the API request, database transition, object operation, and audit event. Alert on verification failures, repeated cross-tenant authorization denials, and an unusual gap between accepted uploads and verified records. These are control signals, not just infrastructure metrics.
A controlled rollout for the receipt path
Start with one adapter and a contract test suite that every adapter must pass. The suite should verify key construction, tenant rejection, idempotent replay, digest preservation, incomplete-upload cleanup, and a read after restore. Run it against a local or test-compatible implementation first, then against each production provider before migration.
During migration, dual-write only when the audit record can distinguish the primary copy from the candidate copy. Compare digests, lengths, metadata, and tenant ownership; do not call two successful writes proof of correctness. After a bounded observation period, switch reads by an explicit version on the receipt row, retain the original mapping for rollback, and record the migration event.
The durable design is therefore modest: tenant identity lives in the domain record, authorization is checked before object access, immutable bytes are hashed, retries are idempotent, and recovery is tested as a tenant-scoped operation. Once those invariants hold, the storage choice becomes an adapter decision that can be revisited without rewriting the audit model. That is the boundary worth preserving.
Sources and References
- AWS S3 Multipart Upload overview: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
- AWS S3 User Guide: https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html
- Wasabi S3-compatible API reference: https://docs.wasabi.com/docs/s3-compatible-api
- Backblaze B2 S3-Compatible API: https://www.backblaze.com/docs/cloud-storage-s3-compatible-api
- NIST Digital Identity Guidelines, Authentication and Lifecycle Management: https://pages.nist.gov/800-63-4/sp800-63b.html
Top comments (0)