A user should be able to shorten links
A user should be able to signup, login and log out
A user should be able to manage stored links, e.g delete or modify them
A user should be able to share shortened links, e.g copy to clipboard or share on social media
A user should be able to set a expiration time for the link
Low latency
Scalable
Deployed in multi region
Custom branding for links
Average filesize: 0,5 MB (This is high)
Number of request / day: 20 000 (avg)
Number of request / week: 140 000 (avg)
Link expiration, in days: 7 (avg)
Total filesize added each month: ~9.7 GB
Let's make it easy and say that files have an average expiration of 7 days and then gets deleted.
/link
/links/$userId
AWS DynamoDB (NoSQL) will be used.
Table 1 - User:
Table 2 - Links:
Used CDN is Cloudfront, which act as the client in this scenario.
The user make request to the API Gateway (API Endpoints outlined under "API Design).
API GW calls a lambda, with the purpose of doing the actual transformation from a long link to a shortlink. Another lambda is called which adds metadata, expiration date and userdata and then stores the data in DynamoDB.
Authentication is handled by Cognito, which on login calls a Lambda that sets last_login in the User table in the database. Alternative, this could also be handled by setting the last_login to when a user creates a new shortlink.
Signup
Login
Link creation
API scales automatically
Lambda scales automatically
DynamoDB scale good, especially with GSI on long link.