Netflix Clone
Global video streaming architecture separating the studio encoding pipeline (Step Functions, MediaConvert, MediaPackage) from low-latency playback (CloudFront signed cookies, Fargate, Redis, and Kinesis).
- MediaConvert ABR ladder
- MediaPackage JIT + DRM
- CloudFront signed cookies
- Kinesis telemetry batching
Amazon Route 53
Route 53 Geo-Latency DNS
AWS WAF
AWS WAF & Shield
Amazon CloudFront
CloudFront HLS/DASH CDN
Amazon API Gateway
API Gateway Control Plane
Amazon Cognito
Cognito Account & Device Auth
Amazon Simple Storage Service
S3 Master Studio Mezzanine
AWS Step Functions
Step Functions Encoding DAG
AWS Elemental MediaConvert
MediaConvert ABR Ladder
AWS Elemental MediaPackage
MediaPackage JIT Packager
Amazon Simple Storage Service
S3 Encoded Segments Store
Amazon S3 Glacier
S3 Glacier Deep Archive
AWS Fargate
Catalog & Profile Service
AWS Fargate
Playback Licensing & Manifest API
Amazon ElastiCache
ElastiCache Active Streams & Cache
Amazon OpenSearch Service
OpenSearch Title & Genre Index
Amazon DynamoDB
DynamoDB Viewing History & Bookmarks
Amazon Kinesis Data Streams
Kinesis QoE & Heartbeat Stream
AWS Lambda
Stream Position Persister
The problem
Streaming to 500k+ concurrent viewers requires separating catalog browsing and entitlement checks from multi-gigabyte video delivery. A 150 GB studio master must be transcoded into adaptive 2-second chunks (360p to 4K HDR) so players can switch bitrates smoothly without hammering the backend.
Step-by-step flow
Parallel ABR encoding and cold archive
Uploading a studio master to S3 triggers Step Functions and MediaConvert to encode 2-second CMAF chunks from 360p to 4K across AV1, HEVC, and H.264. Raw masters move to S3 Glacier Deep Archive after 7 days.
S3 · Step Functions · MediaConvert · S3 GlacierLow-latency catalog browse and search
API Gateway and the Fargate Catalog service serve precomputed genre rows from ElastiCache Redis and run typo-tolerant title searches on OpenSearch in under 25ms.
API Gateway · Fargate · ElastiCache Redis · OpenSearchPlayback authorization and signed cookies
On Play, the Fargate Playback service checks active stream count in Redis (45s TTL lease) and fetches the resume bookmark from DynamoDB, returning a MediaPackage manifest URL and a CloudFront signed cookie.
Fargate · ElastiCache Redis · DynamoDB · MediaPackage · CloudFrontEdge chunk streaming and Kinesis heartbeat batching
Players pull cached `.m4s` segments directly from CloudFront. Every 10s, playback heartbeats stream into Kinesis Data Streams, where Lambda coalesces updates and writes resume timestamps to DynamoDB.
CloudFront · Kinesis Data Streams · Lambda · DynamoDB
Key decisions & benefits
CloudFront signed cookies instead of per-segment signed URLs
Issues one path-scoped signed cookie (`/titles/{id}/*`) at playback start instead of signing thousands of 2-second segment URLs.
Why it works: Keeps manifests and video chunks 100% cacheable across all viewers at the CDN edge.
Kinesis batching for player progress heartbeats
Streams 10-second player pings into Kinesis and uses Lambda to flush only the latest bookmark per viewer every 60 seconds.
Why it works: Cuts DynamoDB write consumption by over 80% during prime-time traffic.
Redis 45-second TTL leases for concurrent stream caps
Tracks active device streams in Redis with a 45-second TTL refreshed by player heartbeats.
Why it works: Sub-millisecond concurrency checks that auto-release slots if a TV or browser crashes.
S3 Lifecycle transition to Glacier Deep Archive
Moves multi-hundred-GB raw studio mezzanine files to Glacier Deep Archive 7 days after encoding.
Why it works: Cuts master storage cost by ~95% ($0.00099/GB-month) while keeping active segments in S3 Standard.
AWS services used (16)
Amazon Route 53 Geo-Latency DNS
Routes viewers to the closest edge.
AWS WAF Edge Security
Blocks credential stuffing and scraping.
Amazon CloudFront Video CDN
Delivers 2s chunks with signed cookies.
Amazon API Gateway Control Ingress
Routes browse, play, and heartbeat calls.
Amazon Cognito Subscriber Auth
Manages account and device tokens.
Amazon S3 Segment Store
Holds master uploads and CMAF chunks.
Amazon S3 Glacier Master Archive
Cold storage for raw studio files.
AWS Step Functions Encoding DAG
Coordinates parallel scene encoding.
MediaConvert ABR Transcoder
Encodes AV1, HEVC, and H.264 ladders.
MediaPackage JIT Packager
Outputs HLS/DASH manifests with DRM.
AWS Fargate Control Services
Runs Catalog and Playback APIs.
ElastiCache Redis Stream Leases
Enforces concurrent device limits.
Amazon OpenSearch Catalog Search
Typo-tolerant title and actor search.
Amazon DynamoDB Bookmarks DB
Stores watch history and resume points.
Kinesis Streams Telemetry Ingest
Absorbs millions of player heartbeats.
AWS Lambda Bookmark Writer
Batches Kinesis pings into DynamoDB.
Trade-offs
| Choice | Benefit | Trade-off |
|---|---|---|
| Multi-codec ABR ladder (AV1 + HEVC + H.264) | Saves 30–40% CDN bandwidth on modern clients. | Higher upfront MediaConvert compute and ~2.5× more S3 objects. |
| Windowed Kinesis bookmark batching | Protects DynamoDB from 50k+ writes/sec. | Resume position can lag by 10–30s after an abrupt crash. |
| MediaPackage JIT packaging + DRM | Generates HLS and DASH on demand from one CMAF set. | Requires high CloudFront Origin Shield hit ratios to minimize packaging fees. |
| 45-second Redis stream lease TTL | No stuck locks after network drops. | Up to 45s wait before starting a new device if at tier limit after a hard disconnect. |
Open to Backend & AWS Cloud roles
Hiring for AWS Cloud or Backend Engineering?
Available immediately (UTC+1) for remote roles, sponsored relocation, or B2B contracts.