Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- The URL service should be available all the time
- Should reads the short URL fast so latency is low
- Need more machines as the request of the URL can be in millons per second
API Design
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
Create a service an API which accepts the long URL and convert them using base64 and make it short url and save them in DynamoDB as a key value pair with the partition key. Probably cache them using Redis and if redis fails them fallback to DynamoDB and then return the result to the client.
High-Level Design
An API service sits behind ALB and process the URLs from Redis cache, for the first time from DynamoDB.
Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.