Url shortening service on budget
How to design a highly scalable url shortening system on budget

There are lot of different system design answers for a url shortening service at scale. However, if you are on budget and you want to create something that is simple, cheap and low maintenance here is an interesting one.
We use a simple API gateway for creating the a short url. A url is hashed to a url safe short string and an Amazon AWS S3 object is created. As you know, S3 allows you to set metadata for every S3 object including a 302 url to which the request must be redirected if it is a public object.
S3 objects can be fronted using CloudFront CDN which makes everything global.
We create a bucket “mydomain-urls” and for every new url we create an empy object in the bucket.
mydomain-urls/<hash> and set its metadata to 302 redirect url.
CloudFront can then be setup for this bucket.
We also need to setup a 404 url for the bucket.
Advantages
No database required.
No hot cache/redis or multi region deployments needed. (This is offloaded to cloudfront)
One single server is sufficient for a reasonable load.
The “Read” flow is pretty much handled by CloudFront for us which has very good SLA
CloudFront provides both rate limiting and DDoS protection.
Disadvantages
- No real time stats about requests available but can be done using logs processing.




