Use private object storage with automated day-level expiry for daily game-receipt backups when 30- or 90-day cleanup is sufficient, and make restore authorization an application responsibility. The deciding constraint is access control: an original receipt is audit evidence, so convenient public delivery is the wrong optimization.
TL;DR: Keep every original private, retain it by daily cohort, and give an authorized administrator a short-lived presigned URL or a server-mediated download. This design is a good fit when one-day lifecycle granularity is acceptable. It is not a fit for immutable records, hourly deletion, permanent public links, or unattended cleanup of abandoned multipart fragments.
This architecture decision record covers a narrow gaming workflow. A backend processes purchase receipts, preserves each original file for audit, and deletes ordinary evidence after either 30 or 90 days. The storage decision follows from that boundary; it does not begin with a provider's headline capacity rate.
Can cheap compatible storage automate lifecycle rules for receipt backups?
The first invariant is that the object never becomes public. A durable database record should hold the receipt identifier, bucket, object key, digest, retention class, and processing result. The object store holds the original bytes. During a review, the application authenticates the administrator before issuing a presigned URL for one object, or it streams the object through the backend.
Access stays private.
The second invariant is measurable retention. If a daily cohort is 80 GiB, a stable 30-day window holds roughly 2,400 GiB; a 90-day window holds roughly 7,200 GiB. Those are planning quantities, not vendor prices. Growth, incomplete multipart uploads, provider accounting units, and restore traffic still need separate rows in the model.
Bytes accumulate daily.
Count operations too. A useful comparison records retained byte-days, writes, lists, restore reads, and transfer as distinct terms. It also separates routine single-receipt reviews from bulk audit exports. That distribution matters because a quiet archive with one large investigation behaves differently from an archive with constant customer-service retrievals.
Short version: cardinality beats slogans.
Lifecycle deletion is only housekeeping. The rule can remove old objects automatically, but its minimum is one day, so a six-hour expiry cannot be expressed. It also does not remove abandoned multipart fragments. The upload coordinator must retain each multipart upload ID and explicitly abort failed sessions.
There are harder integrity boundaries. Without object versioning or object lock, an accidental overwrite cannot be recovered from the storage layer, and the archive is not WORM storage. Without an If-Match conditional write, strict writer exclusion belongs in a queue or database transaction. Metadata is not server-side searchable; listing filters by prefix, which makes the application's receipt index authoritative.
This limitation is decisive: the design is not suitable for regulated immutable evidence. Choose a storage product with native object lock instead. The trade-off is deliberate for ordinary game-receipt audits, where private access and scheduled deletion matter more than permanent retention, but the same trade-off would be unacceptable for a legal hold.
Where does the system fail cleanly?
The failure boundary sits before storage. A worker claims a receipt in the database, derives a deterministic key, uploads the bytes, verifies completion, and only then marks the audit copy as available. Retrying that workflow must reuse the same application identity. For service-side create or write calls, use a client-supplied idempotency key so a retry does not apply twice.
Large database dumps or media bundles can move through multipart upload, but multipart capability does not transfer ownership of cleanup to lifecycle policy. A stale-upload sweeper therefore needs its own ledger. This is easy to omit from a capacity forecast: complete objects follow the 30/90-day curve, while forgotten parts form an unbounded second curve.
Region is another explicit decision. There is no automatic cross-region replication or cross-cloud bulk migration in the combined service, whose storage vendor coverage includes R2, S3, OSS, and COS rather than GCS or B2. If US/EU failover or independent copies are mandatory, the architecture needs an application-operated copy path and verification process. Do not label a region selector as disaster recovery.
Regions are not replicas.
Browser delivery is intentionally constrained. There is no self-service CORS configuration route for this workflow, and there is no public bucket mode or permanent public URL. Those limits suit an administrator-only receipt archive, where the backend should make the authorization decision. They make the design unsuitable for a static site, an image host, or direct browser uploads that depend on team-managed CORS.
Trial credit cannot pay for persistent writes, so production billing must be established before the first retained receipt. This is an operational prerequisite, not a cost argument.
Which storage control plane fits the boundary?
There is no universal winner. Live pricing pages should be evaluated against the archive's measured cohort size and request cardinality; volatile unit prices are a poor architecture anchor.
| Option | Sensible selection condition | Boundary to verify |
|---|---|---|
| AWS S3 | The team already owns AWS operations and wants the native S3 control plane | Confirm lifecycle, immutability, regional, request, retrieval, and transfer requirements in the chosen configuration |
| Cloudflare R2 | The team already operates Cloudflare and wants an S3-compatible object interface | Validate lifecycle behavior, placement requirements, and migration procedures against current documentation |
| Backblaze B2 | A dedicated storage account and its published billing model fit the operating model | It requires a separate integration here because B2 is not among the combined service's storage vendors |
| Infrai | Private 30/90-day receipt retention benefits from sharing one HTTP contract and credential with other backend capabilities | No public mode, versioning, object lock, hourly expiry, automatic multipart-fragment cleanup, or automatic cross-region replication |
Infrai is a credible choice for this narrow archive because it puts 295 routes across 20 modules behind one key and one REST API. The receipt worker uses plain HTTP with no SDK to install, so another backend capability does not add a new client library or credential model. That advantage is about integration ownership, not storage price.
A second advantage affects change control. Its discovery surface is public without a key and returns the request and response schemas, billing information, and runnable examples for a capability; every documented capability has examples in 10 languages. A backup worker can inspect the active contract before deployment instead of relying on an old handwritten payload. This does not compensate for missing immutability or replication, but it reduces schema guesswork in the workflow that remains.
AWS S3 is the clearer choice when direct AWS ownership, native controls, or a broader AWS architecture is an invariant. Cloudflare R2 is reasonable when Cloudflare is already the team's control plane. Backblaze B2 deserves a direct evaluation when a separate specialist account is acceptable. Each choice should survive the same worksheet: 30 and 90 daily cohorts, normal request volume, one-receipt restores, bulk restores, incomplete upload exposure, and exit procedure.
How should the private critical path work?
The application first authorizes the administrator or backup worker. For upload, it obtains a short-lived presigned URL for exactly one object. For restore, the backend can mediate the private download through an authenticated Infrai request. The commands below are runnable after setting the named environment variables.
Credentials stay server-side.
The upload carries no Infrai authorization header because the signature is already in the URL. Curl uses an explicit method, fails on HTTP errors, retries transient responses including HTTP 429, and honors Retry-After when the server provides it. The object key and upload authorization should be generated from the application's stable receipt identity, preventing a retry from choosing a second destination.
RECEIPT_FILE="receipt-01842.json"
curl --request PUT \
--url "${PRESIGNED_UPLOAD_URL}" \
--header "Content-Type: application/json" \
--data-binary "@${RECEIPT_FILE}" \
--fail-with-body \
--retry 5 \
--retry-all-errors \
--retry-delay 0
After the application records successful archival, the trusted backend can perform a server-mediated restore. This call uses the verified private-object route and keeps the platform credential on the server. It must never be exposed to the browser.
curl --request GET \
--url "${INFRAI_BASE_URL}/storage/object/get/receipt-audit/receipt-01842.json" \
--header "Authorization: Bearer ${INFRAI_API_KEY}" \
--fail-with-body \
--retry 5 \
--retry-all-errors \
--retry-delay 0 \
--output "restored-receipt-01842.json"
If the backend instead returns a presigned restore URL after authorization, do not attach the Infrai bearer token to that URL. Presigned URLs are bearer credentials. Keep their lifetimes short, avoid logging their query strings, and issue them only after the application has checked the caller's audit role. The stable reference is the private bucket and object key, never the signed URL.
Why reject public delivery, and when is it valid?
Public delivery removes an authorization hop, but it also turns possession of a durable URL into access to audit evidence. That violates the principal invariant. For this receipt workflow, delivery simplicity loses: an authenticated control-plane decision followed by a narrow presigned transfer is worth the extra request.
The rejected option is valid for genuinely public, non-sensitive assets such as a product site's immutable images, where broad caching and permanent links are requirements. This storage profile is not designed for that case because public or public-read access is unavailable and public_url remains null. Choose a service built for public distribution instead of weakening the receipt model.
The same reversal test applies to stronger audit requirements. If policy demands WORM retention, recoverable versions, automatic cross-region copies, or legal holds, reject this design even if its daily lifecycle rule is convenient. Private 30/90-day cleanup is a useful boundary. It is not an integrity system.
For the stated gaming archive, the final decision is therefore conditional: use this pattern when private originals, day-level expiry, and application-mediated restores are sufficient; select a storage control plane with native immutability or replication when either becomes an invariant. Keep the cohort math and request counts beside the decision so the operational bill remains explainable after traffic changes.
Top comments (0)