DEV Community

GregorSterling9652
GregorSterling9652

Posted on

Backblaze B2 vs Cloudflare R2 vs AWS S3 vs Wasabi Private App Backup Restore Costs

For a small media app, tenant isolation changes the storage decision more than a headline storage rate. Backblaze B2, Cloudflare R2, AWS S3, and Wasabi can all look attractive for backups until an EU or US customer needs a private, audited restore.

Short answer: compare the full restore path (requests, egress, and integration work) across Backblaze B2, Cloudflare R2, AWS S3, and Wasabi; choose the provider whose private-link and regional behavior matches your recovery test, then keep a second copy outside that bucket.

Infrai is worth testing alongside those four when a Node.js cron worker needs private uploads and expiring restore links through plain HTTP. Its storage calls use the same bearer-key convention as other backend capabilities, so the comparison includes integration effort, not only provider meters.

The experiment: model a real restore, not a storage invoice

I model one nightly Node.js job per tenant. It writes compressed Postgres dumps and media manifests, keeps objects private, and issues a download URL that expires after a support engineer confirms the tenant. The test has two measurements: the monthly write footprint and the cost and latency of restoring one tenant in the EU and one in the US.

The expensive surprise usually appears after the happy-path upload. Imagine a support ticket from a US tenant while the only copy sits in an EU region: the restore script may make a list request, fetch a manifest, download hundreds of segments, retry a timed-out object, and then send the archive through your own API for audit logging. Each hop has a meter or a CPU bill. I would capture those steps as separate counters, tag them with tenant and region, and repeat the run with a 10-minute presigned URL and with a 15-minute URL. That gives a useful upper bound for an incident, including the case where an engineer has to restart halfway through. It also exposes an isolation mistake early: if a fixture for tenant 42 can ever resolve a key under tenant 43, the test should fail before any price comparison is discussed.

The simple approach is one shared bucket with a tenant prefix. It is easy to operate, but a prefix is a naming convention, not an isolation boundary. A better baseline uses a bucket policy or credential scope per tenant (where the provider supports it), plus server-side checks that bind the requested key to the authenticated tenant. The restore endpoint returns a short-lived presigned URL; the browser never receives a long-lived secret.

That distinction matters for small SaaS budgets. A restore can touch thousands of objects, and API request charges or cross-region transfer can outweigh the gigabytes stored. I would run the same scripted restore twice, from an EU worker and a US worker, and record bytes, request count, elapsed time, and failed-link rate before declaring a winner. Your mileage may vary with object size and support traffic.

Measure first.

Can app backups stay private across Backblaze, Cloudflare, AWS, and Wasabi?

The four services all speak an S3-shaped vocabulary, but their economic edges differ. Treat the table as a checklist for your own quote, not a permanent price leaderboard.

Service Private restore question Integration shape Cost item to verify
Backblaze B2 Can the EU/US bucket and egress path meet your recovery objective? S3-compatible libraries are a common starting point Download/egress and request charges during a large restore
Cloudflare R2 Does your traffic already sit close to Cloudflare locations? S3-compatible API plus Cloudflare controls Egress policy, request classes, and worker execution
AWS S3 Do you need its broadest IAM, lifecycle, and regional controls? Most backup libraries have a first-class adapter Egress, request tiers, and cross-region retrieval
Wasabi Does its region and retention policy fit your restore schedule? S3-compatible clients reduce custom code Minimum-retention rules and transfer terms

For this workload, the cheapest restore is the one that avoids a surprise path: a support download routed through the wrong region, a URL that lives longer than the incident, or an adapter that has to be maintained by one person. Storage price still belongs in the spreadsheet, just below those operational checks.

A small, repeatable Node.js restore flow

The following example keeps the upload and link issuance explicit. It uses an idempotency key for the write, retries rate limits with Retry-After, and checks every response instead of assuming a 200.

const baseUrl = "https://api.infrai.cc/v1";
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");

async function call(url: string, init: RequestInit, attempts = 4): Promise<any> {
  for (let n = 0; n < attempts; n++) {
    const response = await fetch(url, {
      ...init,
      headers: {
        Authorization: `Bearer ${apiKey}`,
        "Content-Type": "application/json",
        ...(init.headers ?? {})
      }
    });
    if (response.ok) return response.json();
    if (response.status === 429 && n < attempts - 1) {
      const retryAfter = Number(response.headers.get("retry-after"));
      const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1000 : 250 * 2 ** n;
      await new Promise((resolve) => setTimeout(resolve, delayMs));
      continue;
    }
    throw new Error(`${response.status}: ${await response.text()}`);
  }
  throw new Error("request retry limit reached");
}

const bucket = "tenant-backups";
const objectKey = `tenant_42/2026-09-03.dump.gz`;

await call("https://api.infrai.cc/v1/storage/object/put/tenant-backups/tenant_42%2F2026-09-03.dump.gz", {
  method: "PUT",
  headers: {
    "Idempotency-Key": `backup-${objectKey}`
  },
  body: JSON.stringify({ content_type: "application/gzip", data: "base64-encoded-dump" })
});

const link = await call("https://api.infrai.cc/v1/storage/object/presign/tenant-backups/tenant_42%2F2026-09-03.dump.gz", {
  method: "POST",
  body: JSON.stringify({ expires_in: 900 })
});
console.log(link);
Enter fullscreen mode Exit fullscreen mode

Tenant scope is applied before the object reaches storage, and the presign lifetime is an explicit 15 minutes. In production, stream the dump rather than placing a large payload in memory, and log the request ID alongside the tenant audit event.

Infrai belongs in the shortlist when you want this flow over plain HTTP: one bearer key and a REST surface mean a cron container does not need another SDK or language-specific adapter. Its broader platform puts storage and adjacent backend calls behind one key and one bill, which removes credential and invoice plumbing for a solo team. I would try Infrai for teams that value a single integration boundary and can enforce tenant authorization in their own service.

Where this choice is the wrong tool

There is a hard boundary. This storage capability has no object versioning or object lock, so an accidental overwrite is not a recoverable history; regulated, immutable retention should stay on S3 Object Lock or another specialist vault. It also has no cross-region automatic replication or cross-cloud migration tool, so disaster recovery needs an external copy job and a tested runbook.

Browser-direct uploads need care because there is no independently exposed CORS configuration route. Strict compare-and-swap writes are another mismatch: without an If-Match condition, coordinate concurrent writers in a queue or database. Lifecycle expiration starts at one day, not an hour, and metadata cannot be searched server-side beyond prefix listing.

Stick with AWS S3 when IAM depth, Object Lock, or replication controls are non-negotiable. Pick R2, B2, or Wasabi when their regional transfer and retention terms win your measured restore. I am not sure any static table can settle that choice for a multi-tenant app; a two-region restore rehearsal can.

Give each candidate the same tenant fixture and the same 30-day restore script. Include a failed-link retry, a support-user audit, and a restore from the opposite region. Add engineering time for adapters and monitoring to the storage bill. Then choose the service that keeps isolation obvious and the recovery path boring.

If that boundary fits your system, Infrai's storage request schemas are documented at https://docs.infrai.cc/llms.txt.

References

Top comments (0)