Lesson 11 of 16
39. Design File Storage and Sync (Google Drive / Dropbox)

39.10 How do presigned uploads work?

3 min read+10 XP

Clients upload directly to object storage, so 2.3 GB/s never touches our app servers (Chapter 11):

  • After "which blocks are missing?", the metadata service returns a presigned URL for each: the block's hash, an expiry, and an HMAC signature over both made with a secret only our service knows.
  • The storage layer checks the signature and expiry before accepting the upload, and checks that the uploaded bytes really hash to the name in the URL. In the chapter's code, a valid URL works before its expiry, fails after it, and fails if someone swaps the block hash.
  • Big blocks or files use multipart uploads (on S3: parts from 5 MiB to 5 GiB, up to 10,000 parts), which also makes retries cheap.
  • Downloads work the same way: short-lived signed URLs, often through a CDN, issued only after an access check (owner or shared with this user).

Memory code: "We sign the permission slip; the bytes go straight to storage."