Design a URL shortening platform
Company: Amazon
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
Design a URL shortening platform that maps long URLs to short codes and supports redirection at scale. Define the API (create, expand, delete), code generation strategy (hashing, base-N encoding, collision handling), custom aliases, and TTL/expiration. Propose a data model and storage choices for billions of links, and a read-heavy architecture with caches and CDN. Describe rate limiting, abuse/fraud prevention, analytics (click counts, uniques, geo, time), and GDPR/compliance considerations. Provide a capacity plan (QPS, storage), a fault-tolerant deployment (replication, sharding), and consistency trade-offs.
Quick Answer: This question evaluates competency in system design and distributed systems architecture, including API design, scalable short-code generation, data modeling and storage/sharding, caching and CDN strategies, consistency and fault-tolerance trade-offs, rate limiting and abuse prevention, analytics, compliance, and capacity planning.