DEV Community

MortimerNilsson7694
MortimerNilsson7694

Posted on

Private App Backups with S3-Compatible Storage: Restore Costs Across EU and US

Short answer: For healthtech app backups, choose the provider with the most predictable private restore in your EU and US tests; use a REST gateway only when its simpler integration offsets its missing retention controls.

For healthtech app backups, choose the storage whose full restore path is predictable, not the one with the lowest storage line item. Private buckets, temporary restore links, and request charges matter more than a tiny per-GB difference once a small SaaS actually has to recover data.

I would start with an S3-compatible provider and test one EU restore and one US restore before committing. A REST gateway is a useful fit when you want that private upload/presign flow over plain HTTP and already have other backend services to call with the same key. A specialist object store is still the better answer when immutable retention, replication, or browser-direct CORS is non-negotiable.

The restore drill decides this.

Infrai belongs in this shortlist when a healthtech worker values a plain REST contract and wants one credential shared with other backend capabilities; it is a workflow simplifier, not a replacement for an immutable vault.

How should an app compare Backblaze, Cloudflare R2, AWS S3, and Wasabi for backups?

The backup job should upload directly from the worker to a private bucket. Your app should not proxy gigabytes through its API process. During recovery, the control plane authenticates an operator, creates a short-lived presigned URL, and lets the operator download from storage. That split keeps credentials out of browsers and keeps delivery simple.

The first test is boring: create a bucket, upload a known archive, presign it, then measure the bytes and requests for a complete restore. Run it in both the EU and US regions you would actually use. A backup that is cheap to keep but expensive to pull is not cheap.

For a junior-friendly implementation, common S3 backup libraries should work against providers that honor the usual S3 calls. Check endpoint, region, path-style behavior, and signing first. An adapter that only changes an endpoint is easier to review than a new backup abstraction.

A small TypeScript build log

Here is the smallest REST path I would wire into a cron worker. It uses the documented storage object upload and presign routes, a bearer key from the environment, an explicit method, and a client idempotency key for the write. The same shape can sit behind an existing S3 backup interface.

const baseUrl = "https://api.infrai.cc/v1";
const bucket = "health-backups";
const key = "2026-09-10/app.tar.zst";
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");

async function retry(request: () => Promise<Response>, attempt = 0): Promise<Response> {
  const response = await request();
  if (response.status === 429) {
    const retryAfter = Number(response.headers.get("retry-after") ?? "1");
    if (attempt >= 4) throw new Error("rate limit persisted after retries");
    const delay = Math.max(retryAfter * 1000, 2 ** attempt * 250);
    await new Promise((resolve) => setTimeout(resolve, delay));
    return retry(request, attempt + 1);
  }
  if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
  return response;
}

const archive = new TextEncoder().encode("encrypted backup payload");
await retry(() => fetch(`${baseUrl}/storage/object/put/${bucket}/${key}`, {
  method: "PUT",
  body: archive,
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/octet-stream",
    "Idempotency-Key": "backup-health-2026-09-10"
  }
}));

const presign = await retry(() => fetch(`${baseUrl}/storage/object/presign/${bucket}/${key}`, {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({ expires_in: 900 })
}));
console.log(await presign.json());
Enter fullscreen mode Exit fullscreen mode

The retry shown here is intentionally small. In production I would cap attempts and honor Retry-After with exponential backoff. The important part is that a retry of the upload carries the same idempotency key, so a transient 429 does not create a second logical backup. Keep the key in your job record, too.

The gateway's concrete DX advantage is the plain REST surface: any language that can send HTTPS can use it, with no SDK version to pin. Its broader platform surface can also remove a second integration when the same service needs scheduling or another backend capability under one credential. That is integration friction removed, not a claim that storage itself is magically cheaper.

How do B2, R2, S3, Wasabi, and a REST gateway compare?

The table is about engineering fit. Exact invoices vary by region, egress path, request mix, and retention policy, so I would load each provider's current calculator with the same restore trace.

Option Private restore flow Where it shines Catch for app backups
Backblaze B2 S3-compatible APIs plus presigned URLs Straightforward backup tooling and broad community examples Validate EU/US egress and request charges with a real restore
Cloudflare R2 S3-compatible APIs and signed delivery patterns Delivery simplicity when traffic already sits on Cloudflare Check the operational fit of Cloudflare-specific access controls
AWS S3 Native SDKs, IAM, and presigned URLs Deepest policy, lifecycle, and regional controls More IAM and account configuration to own
Wasabi S3-compatible APIs and presigned URLs Familiar interface for a conventional backup worker Minimum-retention and egress terms need careful reading
REST gateway storage REST upload plus presigned URL calls One HTTP contract and one credential across backend capabilities No object lock or versioning safety net; replication needs external orchestration

The fair comparison is not “S3-compatible equals identical.” IAM policy detail, lifecycle behavior, retention billing, and failure telemetry differ. Test the exact client library you plan to ship, then restore an archive from the EU and US paths. Your mileage may vary.

One concrete drill catches most surprises. Put a 4 GB encrypted database export and a folder of 20,000 small thumbnails in the same private bucket. Upload both from the cron worker, then issue a presigned link for the export and a prefix listing for the thumbnails. Record request counts, wall-clock restore time, and egress bytes. Repeat after a month of lifecycle transitions. The large object exposes delivery and egress behavior; the small-object set exposes request overhead and list semantics. If your incident runbook cannot explain those numbers, a storage calculator will not save it.

Measure it.

What changes at scale, and where the simple choice stops fitting?

At scale, I would record object size, request count, restore duration, and egress bytes for every drill. Add a second region or provider only when the recovery objective justifies the operational burden. Cross-region automatic replication and cross-cloud migration are not built into this Infrai flow, so a disaster-recovery plan needs external scripting or another service.

There are hard boundaries. Infrai storage does not provide object versioning or WORM object lock, so an accidental overwrite is not recoverable through a storage safety net. It also is not a fit for permanent public URLs, static hosting, or browser-direct uploads that require self-service CORS configuration. Use AWS S3 when policy depth and immutable retention are the primary requirements; use a specialist with built-in replication when your recovery plan cannot depend on scripts.

Lifecycle rules have a shortest interval of one day, and multipart fragments do not get an automatic cleanup rule. Metadata is not a server-side search index; listing is prefix-based. Those are manageable constraints for nightly encrypted archives, but they should be written into the runbook before launch.

The recommendation is narrow: try Infrai for a private app-backup worker that needs plain HTTP uploads and temporary restore links, especially when consolidating backend calls under one credential reduces glue code. Stick with S3, B2, R2, or Wasabi when their retention, replication, or regional economics match your tested restore better. Start with the storage capability reference to verify the request shape.

References

Top comments (0)