Creating a scalable and customized shortened URL with Serverless Architecture

Shortened URLs are a great way to share content online, but creating a scalable and customized shortener can be challenging. By using a serverless architecture, like AWS Lambda and Amazon API Gateway, you can easily create a secure and cost-effective URL shortener that can be integrated with other AWS services for storage and high-performance delivery.

In today’s digital age, sharing links has become an integral part of our daily lives. Whether it is for social media, messaging apps, a personal blog post, or a product page, it helps us drive traffic to our online content and stay connected with people. But as we all know, links can be long and unwieldy, making them difficult to share or remember. That is where shortened URLs come into play. By using a serverless URL shortener, you can enjoy the benefits of scalability and cost-effectiveness while also customising the shortened links.

In this blog post, we will explain how you can implement a customized shortened URL for your business needs.

Serverless URL Shortener using AWS (Amazon Web Services)

A serverless URL shortener service can be created using AWS services like AWS Lambda and Amazon API Gateway, which can automatically scale and deploy your code as needed, thus saving costs. It also provides an extra layer of security by allowing you to set up an authentication and authorization system, only allowing authorized users to access the service.

Additionally, it can be integrated with AWS services like Amazon S3, and Amazon CloudFront, for storage and high-performance delivery of shortened links, and can be used in places where there is a character limitation, still redirecting the user to the original URL.

Working of Serverless URL Shortener

The above process flow is an efficient way to create a serverless private URL shortener API that is secure and easy to access for authorized users.


The user hits the S3 bucket with a long URL through the CloudFront distribution which in turn returns the short URL with a custom domain generated from the lambda function.The components involved in the short URL generation process are:

  1. Lambda function
  2. API Gateway
  3. VPC Endpoint

Key Features of Serverless URL Shortener API

The ability to automatically scale and deploy the service based on the number of requests received, without the need for manual intervention.

Implementing measures to secure the service such as VPC endpoint, Security Group, and access restriction to authorized users only.

Custom domain name and SSL certificate
Using a custom domain name and SSL certificate to make the shortened URLs more visually appealing and memorable, and to provide an added layer of security for users.

Logging and monitoring
Implementing a logging system, such as AWS CloudWatch, to monitor the performance of the service and troubleshoot any issues that may arise.

Ability to track the number of clicks, where the clicks are coming from, and how often the shortened URLs are being used to get insights on the usage of the service.

Redirecting the user to the original URL when the short URL is accessed.

The ability to use the service with different platforms, including SMS, social media, and messaging apps.

To summarize, using a serverless URL shortener service provided by AWS services helps in maintaining the process available, efficient, increase agility and flexibility, and helps in optimizing cost. And it can be used in places where there is a character limitation applied without any problem.

GitHub reference link:


Written By:   Umashankar N and Santha Murthy

If you have any questions or suggestions, please reach out to us at

Sharing is caring!


In Blog
Subscribe to our Newsletter1CloudHub