Object storage for files

NoSQL and choosing a database Junior Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Pick the fix

Users' private invoices (PDF) must be downloadable only by their owner. Best serving approach?

Options
Hint 1 of 1

Who checks ownership, and who serves bytes?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Private bucket; after an auth check, return a short-lived presigned URL

Correct. The app authorises; storage serves bytes.

The app decides who may read and the bucket serves the bytes. A presigned URL grants one object for a few minutes, so the private bucket never needs to be public.

Why not the others?
  • B Public bucket with unguessable names. Anyone with the link can read it forever.
  • C Stream every file through the API servers. Works, but wastes app capacity.
  • D Email the PDF and delete it. Not a download path.

30-second answer

Object storage keeps any number of files of nearly any size, durably and cheaply, behind an HTTP API, and doesn't tie files to one server's disk. Store the file there and its metadata (owner, key, size, checksum) in the database. Serve files through presigned URLs or a CDN, not through your app servers. Databases are the wrong place for large blobs: backups, replication and memory all suffer.

Practise saying it · 30 s. No recording, just a timer

Why object storage?

Say your answer out loud, then check which of these points you covered:

  • Durable, cheap, scalable
  • Metadata in DB
  • Presigned URLs
  • No blobs in the DB
  • Lifecycle rules

Deep dive

Amazon S3 is designed for 99.999999999% (11 nines) durability of objects.

S3 has had strong read-after-write consistency since December 2020.

Lifecycle rules move old objects to cheaper tiers or delete them.

Keys should be random or hashed, not user-supplied names.

Common mistakes

  • Storing uploads on an app server's local disk.
  • Public buckets for private files.
  • Large BLOBs in the main database.

Senior take & follow-ups

Durable, cheap, HTTP-addressable; metadata in the database; presigned access.

Follow-up questions

Think of your answer first, then open the hint.

  1. How do clients download private files?

    Show hint

    Short-lived presigned URLs or signed CDN URLs.

  2. Where does the metadata live?

    Show hint

    In the database, linked by object key.

Suggest a fix if something here is wrong or out of date.