Task Description
Your task in this part of the workshop is to extend the system with the ability to track how many times each shortened link has been opened. The system should collect data on the number of clicks for each shortened link, and this data should be accessible to the link owner.
Requirements Summary
- The system should track the number of clicks for each shortened link.
- Click data should be assigned to the correct link and visible to its owner.
- The click count must be updated in real-time or each time the link is opened.
Technical Requirements
- Click Tracking – The system must update the click count for each shortened link upon each opening. This data should be stored in a database and easily accessible to the user.
- API – When a link is opened, the system should increase the click counter. The link owner should access this information via the API.
- Serverless – The system should be based on serverless architecture.
Task
Draw your solution on paper using AWS service icons provided. Your solution should include:
- The architecture of the extended system that tracks the number of clicks for each shortened link.
- Use case diagrams showing how the system increases the click counter each time a link is opened.
- Data access diagrams
Common solution

Edge solution

Data table - simple counter
| PK | GSI1_PK | GSI1_SK | Link | Clicks | |
|---|---|---|---|---|---|
| short_id#abc | client_id#001 | short_id#abc | workshop.lambdapeople.pl | 21 | |
| short_id#def | client_id#002 | short_id#def | aws.amazon.com | 37 |
Data table - detailed tracking
| PK | GSI1_PK | GSI1_SK | Link | Clicks | ClickMeta |
|---|---|---|---|---|---|
| short_id#abc | client_id#001 | short_id#abc | workshop.lambdapeople.pl | 21 | |
| short_id#abc | client_id#001 | short_id#abc#click_id#001 | workshop.lambdapeople.pl | {…} | |
| short_id#abc | client_id#001 | short_id#abc#click_id#002 | workshop.lambdapeople.pl | {…} |
Solution ideas
-
Lambda@Edge with CloudFront:
- Use CloudFront with the Lambda@Edge function to monitor each request and update the click counter without the need for an intermediary page.
- Lambda@Edge runs globally, ensuring fast processing and can simultaneously redirect users to the correct URL.
-
API Gateway with HTTP 301/302 Redirect:
- Use API Gateway to handle requests for shortened links. Each request increases the click counter, followed by a redirect using an HTTP 301 or 302 response.
- This simple solution doesn’t require adding extra logic to the backend.
-
Intermediary Page:
- Create an intermediary page that logs clicks via an API request and then redirects the user to the target URL. This is a classic approach that requires an additional page but offers full control over tracking traffic.