What Are Presigned URLs and When Do You Use Them?
The Problem Presigned URLs Solve
Private objects in cloud storage require authentication. Without presigning, clients need your credentials to access objects. Sharing credentials is dangerous: they access everything, forever. Proxying through your server works but consumes your bandwidth and adds latency.
Presigned URLs provide a middle path. Your server generates a URL with embedded authorization. The client uses that URL directly against storage, never touching your server. Authorization is scoped to one object, one operation, limited time. If leaked, damage is bounded.
How Signatures Work
The URL includes query parameters: access key ID, expiration timestamp, signature, and signed headers. The signature is a cryptographic hash (HMAC SHA256) computed over the HTTP method, path, query parameters, headers, and expiration using your secret key.
The storage server recomputes the signature using its copy of your secret key. If signatures match, the request is authorized. If any signed element changed (different path, expired, modified headers), signatures differ and the request is rejected. The math prevents URL modification without the secret key.
Upload vs Download URLs
Download (GET): Anyone with the URL can read the object until expiration. Use for serving private content to authenticated users: profile images, purchased content, temporary file sharing.
Upload (PUT): Anyone with the URL can write to that specific key until expiration. Use for client side uploads without proxying: file uploads, media ingestion, user content. The client PUTs directly to storage.
You can constrain PUT URLs further: require specific content type, limit content length, require specific metadata. These constraints become part of the signature.