Design YouTube: video upload, transcoding, and CDN
Youtube
Guided ModePre-Signed URLs: Offload Upload to S3
The Video Upload Service issues a short-lived pre-signed URL. The client uploads gigabytes of video directly to S3 — the API never touches a single video byte.
Request Flow
Client requests upload URL
Uploader sends metadata (filename, size, type) to the API. The API calls the Video Upload Service to generate a pre-signed URL.
Client uploads directly
Uploader streams gigabytes straight to S3 using the pre-signed URL. API CPU stays at 2%. S3 enforces size limits and expiry from the signed policy.
Client confirms completion
After the direct upload succeeds, the client POSTs a confirmation to the API. The API records the S3 key in the Database and marks the upload as complete.
Why We Need This
YouTube receives 500 hours of video per minute. If the API proxied every byte, you'd need an API fleet the size of a small data center just for I/O. Pre-signed URLs reduce API bandwidth to zero for uploads.
Key Insight
Pre-signed URLs are the 'valet parking ticket' pattern: your API issues the credential but never touches the car. The client parks directly. This scales S3's 100 GB/s throughput without API involvement.
Step 3 of 9
