
Building My First Serverless URL Shortener with AWS Lambda: My Journey into Cloud Computing
Building a real project is one of the best ways to learn cloud computing. In this article, I share how I built my first serverless URL shortener using AWS Lambda, Amazon API Gateway, DynamoDB, and CloudWatch, the challenges I faced, and the lessons that helped me grow as an AWS Student Builder Group Leader.
When I first started learning cloud computing, I quickly realized that reading about AWS services individually wasn't enough. I understood what services like AWS Lambda, Amazon API Gateway, DynamoDB, and CloudWatch were designed for, but I couldn't fully understand how they worked together in a real application.
I'm Shreekant Bharti, a B.Tech student at BIT Sindri and an AWS Student Builder Group Leader. I enjoy learning by building practical projects because they teach much more than simply watching tutorials or reading documentation.
That curiosity inspired me to build my first serverless URL shortener using AWS.
Although the project itself is simple, it introduced me to APIs, serverless computing, databases, monitoring, permissions, and cloud-native application design.
Why I Chose This Project
Whenever we share links online, they are often long and difficult to remember. URL shorteners solve this problem by generating small links that redirect users to the original website.
Instead of learning the theory behind these services, I wanted to build one myself.
My goal wasn't to create the next Bitly. My goal was to understand how AWS services work together while staying within the AWS Free Tier.
Understanding the Challenge
One challenge every beginner faces is connecting different AWS services into one complete application.
Learning AWS Lambda separately is easy.
Learning DynamoDB separately is also easy.
The real learning begins when you combine these services to solve a practical problem.
This project helped me understand exactly that.
Solution Architecture
The application follows a simple workflow.
- A user submits a long URL.
- Amazon API Gateway receives the request.
- AWS Lambda processes the request.
- Lambda generates a unique short code.
- The mapping is stored in Amazon DynamoDB.
- The shortened URL is returned to the user.
- When someone visits the short link, another Lambda function retrieves the original URL from DynamoDB and redirects the user.
Keeping every AWS service focused on one responsibility made the application easier to understand and maintain.
AWS Services Used
AWS Lambda
AWS Lambda became the core of this project.
Instead of managing servers, I only focused on writing the application logic. Lambda automatically handled execution whenever someone used the API.
For someone learning cloud computing, this made development much simpler.
Amazon API Gateway
API Gateway acts as the entry point of the application.
It securely receives HTTP requests and forwards them to Lambda.
This project helped me understand how REST APIs work inside serverless applications.
Amazon DynamoDB
Every shortened URL needs to be stored somewhere.
DynamoDB was the perfect choice because it provides fast key-value lookups without requiring server management.
Each record stores:
- Original URL
- Short Code
Whenever someone opens the shortened link, DynamoDB quickly returns the original URL.
Amazon CloudWatch
CloudWatch became one of my favorite AWS services during development.
Whenever something didn't work, I checked the logs instead of guessing the problem.
It helped me debug errors much faster and taught me the importance of monitoring cloud applications.
Building the Application
I completed the project in small steps.
First, I created a DynamoDB table.
Next, I built a Lambda function that:
- Validates the submitted URL
- Generates a unique short code
- Stores the mapping inside DynamoDB
- Returns the shortened URL
Then I created another Lambda function responsible for redirecting users.
Finally, I connected both Lambda functions with Amazon API Gateway.
Breaking the project into smaller tasks made learning much easier.
Challenges I Faced
Every project comes with challenges.
One issue was generating unique short codes.
Random values can repeat, so I added a validation step that checks DynamoDB before saving a new record.
Another challenge involved IAM permissions.
Initially, my Lambda function couldn't access DynamoDB.
After checking CloudWatch logs, I discovered that the Lambda execution role didn't have the required permissions.
Updating the IAM policy solved the issue immediately.
That experience taught me an important lesson:
In cloud computing, correct permissions are just as important as correct code.
What I Learned
This project completely changed my perspective on AWS.
Instead of memorizing individual services, I learned how they work together to solve real problems.
The project improved my understanding of:
- Serverless architecture
- REST APIs
- Amazon DynamoDB
- AWS Lambda
- CloudWatch logging
- IAM permissions
- Event-driven applications
Most importantly, it gave me the confidence to build larger cloud projects.
Cost Considerations
One of the best things about serverless architecture is its affordability.
AWS Lambda only charges when code executes, while DynamoDB automatically scales according to usage.
For beginners, projects like this usually remain within the AWS Free Tier, making them ideal for learning.
Future Improvements
Although the project works well, I plan to add several features in the future.
These include:
- User authentication with Amazon Cognito
- Static frontend hosting using Amazon S3
- Click analytics with CloudWatch Metrics
- QR code generation
- Custom domain support
- Improved user interface
Each new feature will help me explore additional AWS services.
Advice for Beginners
If you're starting your AWS journey, don't wait until you think you know everything.
Choose one small project.
Build it.
Break it.
Fix it.
Repeat.
Every mistake teaches something valuable, and every project increases your confidence.
Learning by building is one of the fastest ways to understand cloud computing.
Final Thoughts
Building this serverless URL shortener was much more than creating a simple application.
It helped me understand how AWS services work together to build scalable and reliable cloud-native applications.
As an AWS Student Builder Group Leader, I hope to encourage more students to learn by building real projects instead of only reading documentation.
This project is just the beginning of my cloud journey, and I'm excited to continue learning, experimenting, and sharing my experiences with the AWS community.
If you're planning to start your first AWS project, my advice is simple:
Start today. Every small project brings you one step closer to becoming a better cloud builder.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article