Skip to main content

Project Overview

Estimated Time: 2-3 hours | Difficulty: Intermediate | Cost: ~$5/month for testing
In this hands-on project, you’ll build a complete serverless URL shortener service. This is a common system design interview question and demonstrates key serverless patterns. Think of it as building a mini Bit.ly — a deceptively simple product that touches nearly every serverless building block AWS offers, from API design to data modeling to edge caching. What You’ll Build:
  • REST API with API Gateway (your front door — all traffic enters here)
  • Lambda functions for business logic (stateless compute that scales to zero)
  • DynamoDB for data persistence (single-digit millisecond lookups at any scale)
  • CloudFront for caching and performance (reduces Lambda invocations by 80%+ for redirects)
  • Complete observability with CloudWatch and X-Ray (because you cannot improve what you cannot measure)
Skills Demonstrated:
  • Serverless architecture design
  • DynamoDB data modeling (single-table design for a real use case)
  • API design and implementation
  • Cost optimization (this architecture costs roughly the price of a coffee per month at moderate traffic)
  • Production-ready practices (error handling, monitoring, security layers)

Architecture Overview

Let’s design a serverless web application for a URL shortener service.

Requirements

  • Handle 10,000+ requests per second
  • Sub-100ms latency
  • 99.9% availability
  • Pay only for actual usage
  • Auto-scaling without management

High-Level Architecture


Implementation

1. DynamoDB Table Design

2. Lambda: Create Short URL

3. Lambda: Redirect

4. API Gateway Configuration


Scaling Considerations

API Gateway Limits

Lambda Concurrency

DynamoDB Capacity


Cost Analysis


Monitoring & Observability


Security Considerations

API Gateway

  • WAF integration
  • API keys for rate limiting
  • Request validation

Lambda

  • Least privilege IAM
  • VPC for private resources
  • Secrets in Secrets Manager

DynamoDB

  • Encryption at rest
  • IAM for access control
  • VPC endpoints

CloudFront

  • HTTPS only
  • Geo-restrictions if needed
  • Origin Access Identity
Key Takeaway: Serverless architectures eliminate server management, scale automatically, and cost effectively for variable workloads. Start simple and add complexity (caching, analytics) as needed.

🎯 Interview Questions for This Case Study

Advantages:
  • Variable traffic (pay for actual usage)
  • No server management
  • Auto-scales from 0 to millions
  • Quick time to market
Trade-offs:
  • Cold start latency (mitigate with provisioned concurrency)
  • 15-minute function limit (not an issue here)
  • Vendor lock-in
When NOT serverless:
  • Predictable, constant high traffic (EC2 cheaper)
  • Long-running processes
  • WebSocket-heavy (API Gateway WS works but pricey)
Scaling strategy:
  1. CloudFront: Cache redirects at edge
    • 301 with Cache-Control: max-age=300
    • 80%+ cache hit ratio
  2. API Gateway: Request higher limits
    • Default 10K/sec is usually enough
  3. Lambda: Reserved concurrency
    • Set to expected peak (e.g., 5000)
  4. DynamoDB: On-demand mode handles spikes
    • Add DAX for microsecond reads
  5. Monitoring: Alarms before hitting limits
Defense layers:
  1. Rate limiting: API Gateway usage plans
  2. WAF: Block malicious IPs, SQL injection
  3. CAPTCHA: For create endpoint
  4. URL validation: Block malicious targets
  5. User authentication: Cognito for premium features
Async analytics pipeline:
  1. Log click events to Kinesis (async, non-blocking)
  2. Firehose batches to S3 every 60 seconds
  3. Query with Athena for dashboards
Metrics to track:
  • Click count per URL
  • Geographic distribution
  • Referrer analysis
  • Time-based patterns
Cost breakdown at 100M requests/month:Optimization opportunities:
  • CloudFront caching (reduces Lambda calls 80%)
  • Reserved concurrency (predictable billing)
  • DynamoDB provisioned (if traffic predictable)

🧪 Hands-On Implementation Steps

1

Create DynamoDB Table

Create table with on-demand billing and TTL enabled
2

Create Lambda Functions

Deploy create and redirect functions with proper IAM roles
3

Set Up API Gateway

Create REST API with two endpoints, deploy to prod stage
4

Add CloudFront Distribution

Point to API Gateway, configure caching
5

Configure Monitoring

Set up CloudWatch alarms and X-Ray tracing
6

Test Load

Use Artillery or hey to test performance

Course Complete! 🎉

Congratulations on completing the AWS Cloud Fundamentals course! You’ve learned:
  • ✅ AWS core concepts and regions
  • ✅ Compute services (EC2, Lambda, ECS)
  • ✅ Storage and databases (S3, RDS, DynamoDB)
  • ✅ Networking (VPC, security groups, load balancers)
  • ✅ Security (IAM, KMS, encryption)
  • ✅ Well-Architected Framework
  • ✅ Real-world serverless architecture
Next Steps:
  1. Practice with hands-on labs
  2. Build your own projects
  3. Prepare for AWS certification
  4. Review interview questions regularly

Return to Course Overview

Review the complete curriculum and resources