Node.js Cron Data Backups: Tenant-Isolated Object Uploads and Presigned Recovery
Object storage for e-commerce app data backups is a tenant-isolation problem before it is a capacity problem. A valid restore must select one tenant, one backup run, and one retention class without exposing another shop's data. TL;DR: Put private, compressed database dumps in a dedicated object-storage bucket. Give every run a new key containing the tenant ID and UTC date, maintain a small…
Node.js applications can upload e-commerce data backups to object storage in a secure, tenant-isolated manner. The key is to use a dedicated backup bucket and a unique key that incorporates the tenant ID and UTC date. This ensures that only the authorized tenant can access the backed-up data.
To implement this solution, start by generating a unique object key using the tenant ID and a random run ID. Calculate the SHA-256 checksum of the gzip dump file and write a local JSON manifest containing the checksum. This manifest can be stored in an audit store or database for later verification.
Use the provider's REST API to upload the gzip dump file to the object storage bucket. Generate a unique upload URL and include an Idempotency-Key header in the request to prevent accidental overwrites. The upload process should be performed by a server or worker to avoid CORS limitations.
For added security, issue a short-lived signed URL after the application authorizes the restore. This ensures that only the intended tenant can access the backed-up data. Additionally, use bucket lifecycle rules for routine deletion, but keep an external copy for recoverability.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.