The constraint that decides this isn't bandwidth, and it isn't the per-GB cost of egress either. It's deletion: when a merchant leaves your e-commerce platform, can you show that their private document snapshots are gone, and on what clock? Pick the object storage provider whose retention and deletion primitives match the promise written in your contract, then treat signed URL expiry as a second, much shorter clock layered on top. Presigned URLs for private document downloads are the easy part — every serious provider signs them, and the differences that actually bite live in lifecycle rules, versioning, and what the access logs can tell you a month later.
Deletion first. Signing second.
The snapshot you can prove you deleted is the only one worth signing
Here's the system I keep seeing in e-commerce: every tenant gets a nightly export — orders, refunds, and a pile of invoice PDFs — packed into one object per night. Support or the merchant's own admin picks a snapshot from a list and downloads it during a restore. The download is a signed URL. The hard part was never signing.
The hard part is that two clocks are running and nobody wired them together. Clock one is your retention rule: "tenant snapshots live 35 days, offboarded tenants purge in 7." Clock two is the signature TTL. When a support engineer hands a merchant a link valid for a week and the lifecycle rule deletes the object on day three, the merchant gets a 404 from a URL that still looks perfectly valid, and your on-call gets a ticket that takes an hour to explain.
Versioning makes it worse in a quieter way. Turn it on for safety, delete an object, and you get a delete marker while the noncurrent version sits there — still billed, still restorable, still discoverable by anyone with the right API call. That's fine engineering, right up until a data processing agreement says "deleted" and an auditor asks what that word means in your bucket.
Before and after: one prefix per tenant, one lifecycle rule, one short signature
Before, in the setup I'd expect most teams to start with: a single bucket, keys like snapshots/2026-09-12/acme.tar.zst, a 35-day retention policy that exists only in a wiki page, deletes done by hand during offboarding, and signature TTLs copied from a tutorial (seven days, because that was the maximum the tutorial mentioned).
After: the tenant id is the first path segment, so snapshots/acme/2026-09-12T02-00Z.tar.zst can be targeted by a lifecycle rule scoped to exactly that prefix. Retention lives in config that ships with the service, not in prose. Signatures are minutes, not days. And every issuance writes an audit line.
The flow in words: request arrives → authorize the tenant → resolve the snapshot id to a key → check the retention state → sign for the shorter of the two clocks → log the issuance → the client GETs the object directly from storage → the storage access log records the hit.
That last arrow is the one people skip, and it's the one that makes restores debuggable.
interface Snapshot {
id: string;
tenantId: string;
key: string; // snapshots/<tenant>/<iso-timestamp>.tar.zst
bytes: number;
retentionEndsAt: string; // what the lifecycle rule will enforce
legalHold: boolean; // set during a dispute, blocks expiry
}
interface AuditEvent {
kind: "snapshot.download.signed";
snapshotId: string;
tenantId: string;
actorId: string;
ttlSeconds: number;
bytes: number;
}
const MAX_TTL_SECONDS = 600;
export async function signSnapshotDownload(
snap: Snapshot,
actor: { id: string; tenantId: string },
deps: {
sign: (key: string, ttlSeconds: number) => Promise<string>;
now: () => Date;
audit: (event: AuditEvent) => void;
},
): Promise<{ url: string; expiresAt: string }> {
if (snap.tenantId !== actor.tenantId) throw new Error("cross_tenant_denied");
const now = deps.now();
const retentionEndsAt = new Date(snap.retentionEndsAt);
const remainingSeconds = Math.floor((retentionEndsAt.getTime() - now.getTime()) / 1000);
if (!snap.legalHold && remainingSeconds <= 0) {
// Past its retention window: the lifecycle rule owns this key now.
throw new Error("snapshot_retired");
}
// Never sign past the retention clock. A link that outlives the object is a support ticket.
const ttlSeconds = snap.legalHold ? MAX_TTL_SECONDS : Math.min(MAX_TTL_SECONDS, remainingSeconds);
const url = await deps.sign(snap.key, ttlSeconds);
deps.audit({
kind: "snapshot.download.signed",
snapshotId: snap.id,
tenantId: snap.tenantId,
actorId: actor.id,
ttlSeconds,
bytes: snap.bytes,
});
return { url, expiresAt: new Date(now.getTime() + ttlSeconds * 1000).toISOString() };
}
Ten minutes is not a magic number. It's short enough that a leaked link in a shared inbox is worthless by the time anyone finds it, and long enough for a 4 GB archive to start downloading on hotel wifi. If your restores are human-driven, a short TTL plus a re-sign button beats a long TTL every time.
How should I compare presigned URL expiry and retention across object storage providers?
Four axes, in the order they'll hurt you.
Signature lifetime and what kills it early. S3 presigned URLs created with SigV4 top out at seven days, and the signature dies sooner if the credential that signed it — a role session, for instance — expires first. That coupling is a feature: rotate the signer, and every outstanding link goes with it. Supabase Storage takes an expiresIn in seconds and resolves who may ask through row-level policies, so the authorization story sits in Postgres instead of IAM. Firebase Storage has two doors that look alike and behave differently: tokenized download URLs stay valid until someone revokes the token, while V4 signed URLs minted through the Admin SDK genuinely expire. For per-tenant snapshots, only the second door gives you a clock.
Deletion primitives. This is the axis that decides the argument, and it's the one the comparison posts skip. You want prefix-scoped lifecycle expiry, a way to count and purge noncurrent versions, and — if regulated documents are in scope — a retention hold that even an admin can't shortcut. R2 bills no egress fee and speaks an S3-compatible API with lifecycle rules, which removes the bandwidth line from the spreadsheet without removing any of the retention work. Self-hosted MinIO gives you the same signing surface and object-lock semantics on your own disks, which matters when a customer's contract names a jurisdiction.
| Mechanism | What it actually guarantees | What to log |
|---|---|---|
| Signed URL expiry | A link stops working at a known time | issuance time, TTL, actor, snapshot id |
| Lifecycle / TTL rule | Objects under a prefix eventually disappear | delete events per prefix, bytes reclaimed |
| Versioning | Overwrites and deletes are recoverable | noncurrent version count and bytes |
| Retention hold / object lock | Even an admin can't delete early | hold set and released, and by whom |
Observability of the delivery path. Signed URLs move the download off your servers, which means your application metrics go blind exactly when the bytes start flowing. Server access logs on the bucket, or an event notification on object reads, are how you get that visibility back.
Cost shape. Per-GB egress, request counts, storage class, and minimum storage duration interact; I'll come back to that.
What your dashboards should show during a tenant restore
One counter with three labels carries most of the weight.
type DownloadOutcome = "ok" | "signature_expired" | "object_retired" | "denied" | "other";
export function classifyOutcome(status: number, body: string): DownloadOutcome {
if (status < 400) return "ok";
if (status === 403 && /expired/i.test(body)) return "signature_expired";
if (status === 404 || status === 410) return "object_retired";
if (status === 401 || status === 403) return "denied";
return "other";
}
export function recordOutcome(
metrics: { inc: (name: string, labels: Record<string, string>) => void },
tenantId: string,
outcome: DownloadOutcome,
): void {
metrics.inc("snapshot_download_total", { tenant: tenantId, outcome });
}
Three alerts are worth the pager. A spike in signature_expired means your TTL is shorter than real download times — raise it, or re-sign on retry. A spike in object_retired right after a lifecycle run means retention and the snapshot list disagree, which is the bug that used to arrive as a customer email. And egress bytes per tenant, compared against the nightly snapshot size, catches both a runaway retry loop and someone sharing links they shouldn't.
Before, a failed restore was a ticket. After, it's a log line with a snapshot id in it.
The retention clock, the bill, and the part that surprises finance
Egress is the number everyone compares, and it's rarely the number that moves the bill for this workload. Per-tenant backup archives are written once, read almost never, and kept for months — so storage-months and minimum storage duration dominate, and those are exactly the knobs tied to your retention policy. Infrequent-access and archive classes charge for a minimum number of days whether or not the object survives that long, so a 7-day purge promise layered on a 30-day minimum duration class means you pay for days of storage you already deleted. Restores, when they do happen, pull a whole archive at once, which makes egress spiky rather than large.
The catch is that zero-egress pricing doesn't buy you any of the governance. You still own the lifecycle rules, the versioning cleanup, the hold mechanism, and the audit trail — and a migration to save bandwidth you barely spend is a strange trade when snapshot retention is the actual risk. Stick with your primary provider's native lifecycle and lock primitives when auditors want one coherent story, and treat a second storage backend as a deliberate cost decision rather than a default. Object storage isn't suitable when tenants need row-level, queryable history of their orders; that's a database problem wearing a backup costume, and a nightly tarball won't answer it.
So: write the deletion rule, express it as config, derive the signature TTL from it, and log both. I'm not sure there's a single correct retention window — 35 days is a number I've seen work, not a law — but deriving one clock from the other is the part that holds up under audit.
Sources
- AWS: Sharing objects with presigned URLs — https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html
- AWS: Multipart upload overview — https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
- AWS: Managing the lifecycle of objects — https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
- AWS: Using S3 Object Lock — https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html
- AWS: Storage classes and minimum storage duration — https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html
- AWS: Logging requests with server access logging — https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html
- Cloudflare R2 pricing — https://developers.cloudflare.com/r2/pricing/
- Supabase Storage: createSignedUrl — https://supabase.com/docs/reference/javascript/storage-from-createsignedurl
- Firebase: Download files with Cloud Storage — https://firebase.google.com/docs/storage/web/download-files
- Backblaze B2 pricing — https://www.backblaze.com/cloud-storage/pricing
Top comments (0)