Object storage
Amazon S3
Cheap, durable storage for files and blobs (images, videos, backups) addressed by key.
In a monolith
Local disk
Uploads land on the server’s disk — which breaks with two servers (each has different files) and dies with the server.
In a distributed system
Shared blob store
Every service reads and writes blobs in a bucket; clients upload/download directly with presigned URLs; a CDN serves them.
On AWS
Amazon S3
Designed for eleven nines of durability, effectively unlimited capacity, lifecycle tiers (Standard → IA → Glacier) and event notifications on upload.
- S3 Standard$Hot data, millisecond access
- S3 Intelligent-Tiering$Moves objects between tiers by access pattern
- S3 Glacier tiers$Archive; minutes-to-hours retrieval
- Reach for it when
- Any file or blob, from day one — never keep user files on app server disks.
- What it costs you
- Higher latency than a database (tens of ms) — not for tiny hot records
- Egress costs; put a CDN in front
- A public-bucket misconfiguration leaks data
- When it dies
- Rare and regional. Uploads/downloads fail, but metadata in your DB is fine; durability (not losing data) is the strong guarantee.
Interview follow-ups
How does a presigned URL work?
Your backend signs a URL granting one operation (PUT/GET) on one key for a few minutes; the client uses it directly, and no credentials leave your servers.
Where do you store image metadata?
In a database (owner, size, status, key); the bytes live in object storage. Never put large blobs in a relational DB.
Connection rules
It talks to
- Queue
- Pub/sub topic
- WorkerOnly when: S3 can invoke a function directly (S3 → Lambda); a queue in between adds buffering and retries.
Gets traffic from
- CDN
- App server
- Service
- Worker
- Realtime server
- ClientsOnly when: Through presigned URLs issued by your backend — the recommended way to upload/download large files, because the bytes skip your servers entirely.
- Event streamOnly when: Managed delivery (e.g. Data Firehose → S3) for archiving and analytics.
Never
- Load balancer → Object storageA load balancer forwards HTTP to compute. Data access needs code: auth, queries, validation.
- API gateway → Object storageA gateway routes to compute; data access needs your code.
- Queue → Object storageQueues don’t run code. A consumer reads the message and does the write or call.
- Pub/sub topic → Object storageTopics don’t run code. A subscriber receives the event and does the write.