Object storage, backups and portability
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- A backup that was never restored is not a backup. Test restores and record them.
- Files go through one storage layer over an S3-compatible API; provider, bucket and keys come only from settings.
- From class L: backups at another provider or account, encrypted, with failure alarms; object storage has versioning; the owner receives a full code copy regularly.
Which class?
This topic has items from class S. The blocks below are cumulative: read up to your own class.
- S: 1 items
- M: 5 items
- L: 7 items
- XL: 2 items
Audit checklist
Every project
- Git history is clean and explains itself
- What: Each logical change is its own commit with a message that says what changed and why; no force pushes; main branch changes only with the owner’s approval.
- How to check: Run
git log --oneline -30; check branch protection or the owner’s rule; look for--forceor--no-verifyin scripts. - Evidence: Commit list, branch settings, absence of force-push scripts.
+ If it has users, personal data or API keys (M)
- Files use an S3-compatible API behind one storage layer
- What: Files are stored through an S3-compatible API; only one storage service class talks to the provider; endpoint, bucket and keys come only from settings.
- How to check: Search the code for provider-specific imports outside the storage layer; read the settings loader.
- Evidence: Storage layer file; search result with no provider types outside it.
- One command starts everything locally
- What: The project starts locally with one command (for example
docker compose up) including database and object storage; the same image runs in every environment and only settings differ. - How to check: Read the compose file and Dockerfile; run the command on a clean checkout.
- Evidence: Compose file path; successful start log.
- What: The project starts locally with one command (for example
- Automatic backups with a tested restore
- What: The database is backed up automatically, retention is written down, and a restore has actually been tried.
- How to check: Find the backup job and its schedule; find the record of the last restore test.
- Evidence: Backup schedule, retention setting and dated restore-test record.
- Restores are rehearsed on a schedule
- What: A restore into a clean environment is done regularly and the result (time taken, data checked) is recorded.
- How to check: Find the last restore record.
- Evidence: Dated restore record.
- One deletion schedule covers all data
- What: Every kind of data has a deletion period, collected in one deletion schedule document, and the code implements it.
- How to check: Find the document; for each row find the job or code that deletes the data.
- Evidence: Schedule document and the matching job names.
+ If it has an admin panel, file uploads, many users or a store app (L)
- Direct signed uploads and orphan file scan
- What: Clients upload directly to storage with signed, expiring URLs; large files use resumable multipart upload; delete failures are not swallowed; an orphan file scan exists; a new media column updates the delete path, the orphan scan and storage permissions together.
- How to check: Read the upload flow and the cleanup job; add a test file with no database row and see if the scan finds it.
- Evidence: Upload code; scan report.
- Orphan files are found and removed
- What: Files without a database record are detected by a scan and removed (an orphan file is a privacy risk).
- How to check: Read the orphan scan job.
- Evidence: Scan report.
- Object storage has backup or versioning
- What: Files in object storage can be recovered after deletion or overwrite through versioning, replication to another account or a backup.
- How to check: Read bucket versioning and replication settings.
- Evidence: Bucket configuration.
- Encrypted backups sit with another provider, and code is copied
- What: Backups are encrypted and kept in a different provider or account so a compromised main account cannot delete them; object storage has versioning or backup; backups run as a separate service with failure alarms; a full copy of the code (all branches, history) is delivered to the owner regularly.
- How to check: Read backup configuration, destination account and alarms; find the last code copy.
- Evidence: Backup destination; alarm rule; date of last code copy.
- Switching provider is a settings change
- What: Moving to another provider of the same kind (database host, S3-compatible store, mail service) needs only new settings, not code changes; each service sits in its own module.
- How to check: Search for provider-specific calls outside the service module; try the app against a local MinIO and a plain PostgreSQL.
- Evidence: Module list; local run with other providers.
- Container is hardened and stateless
- What: Multi-stage image, non-root user, base image pinned by digest, health check endpoint; runtime versions identical in CI, local and production; no state in the container disk (sessions and files live in the database or object storage).
- How to check: Read the Dockerfile; run
docker inspectfor the user; look for files written to the container disk. - Evidence: Dockerfile lines; health endpoint response.
- Unknown or missing settings stop the process
- What: The process refuses to start with an unrecognized environment value or a missing required setting; there is no silent fallback; checks ask “is this development or test?” rather than “is this not production?”; endpoint groups can be locked by a single feature-lock file.
- How to check: Start the app with a missing required variable and a wrong environment name; read the lock file.
- Evidence: Startup failure message; lock file.
+ If it targets millions of users (XL)
- Disaster recovery plan with RPO and RTO
- What: A written plan states acceptable data loss (RPO), recovery time (RTO) and step-by-step recovery.
- How to check: Find the plan; check that a drill was run.
- Evidence: Plan and drill record.
- Region-aware design and Standard lines
- What: Every user has a data region and personal data, files and backups stay in it; moving a user or country between regions is possible with a verifiable, resumable tool; each code commit has a
Standard:line. - How to check: Read the user model and storage configuration; read recent commits.
- Evidence: Region field; commit examples.
- What: Every user has a data region and personal data, files and backups stay in it; moving a user or country between regions is possible with a verifiable, resumable tool; each code commit has a
Common mistakes
- Backups taken but never restored in a test.
- Backups in the same account as production, deleted together after a compromise.
- Provider-specific storage calls spread through the code.
- Files stored on the container’s own disk.
- Delete errors swallowed, leaving orphan files.
- Public buckets by accident.
- A new media column added without updating the delete path and orphan scan.
- No alarm when the backup job fails.
Sources
- S3: presigned URLs — AWS
- S3: multipart upload — AWS
- S3: Versioning — AWS
- S3: Object Lock — AWS
- S3: Replication — AWS
- S3: Expiring objects — AWS
- Well-Architected Reliability: back up data — AWS
- REL13-BP02 Use defined recovery strategies — AWS
- R2: S3 API compatibility — Cloudflare
- PostgreSQL: Backup and Restore — PostgreSQL Global Development Group
- PostgreSQL: Continuous Archiving and Point-in-Time Recovery — PostgreSQL Global Development Group
- PostgreSQL: SQL Dump — PostgreSQL Global Development Group
- SP 800-34 Rev. 1: Contingency Planning Guide — NIST
- Docker Compose — Docker Docs
- Multi-stage builds — Docker Docs
- Docker Engine security — Docker Docs
- The Twelve-Factor App: III. Config — 12factor.net
- The Twelve-Factor App: VI. Processes — 12factor.net
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide