Project Overview
Estimated Time: 2-3 hours | Difficulty: Intermediate | Cost: ~$5/month for testing
- 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)
- 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
🎯 Interview Questions for This Case Study
Q1: Why use serverless for a URL shortener?
Q1: Why use serverless for a URL shortener?
Advantages:
- Variable traffic (pay for actual usage)
- No server management
- Auto-scales from 0 to millions
- Quick time to market
- Cold start latency (mitigate with provisioned concurrency)
- 15-minute function limit (not an issue here)
- Vendor lock-in
- Predictable, constant high traffic (EC2 cheaper)
- Long-running processes
- WebSocket-heavy (API Gateway WS works but pricey)
Q2: How would you handle 1 million concurrent users?
Q2: How would you handle 1 million concurrent users?
Scaling strategy:
-
CloudFront: Cache redirects at edge
- 301 with Cache-Control: max-age=300
- 80%+ cache hit ratio
-
API Gateway: Request higher limits
- Default 10K/sec is usually enough
-
Lambda: Reserved concurrency
- Set to expected peak (e.g., 5000)
-
DynamoDB: On-demand mode handles spikes
- Add DAX for microsecond reads
- Monitoring: Alarms before hitting limits
Q3: How would you prevent abuse?
Q3: How would you prevent abuse?
Defense layers:
-
Rate limiting: API Gateway usage plans
- WAF: Block malicious IPs, SQL injection
- CAPTCHA: For create endpoint
- URL validation: Block malicious targets
- User authentication: Cognito for premium features
Q4: How would you add analytics?
Q4: How would you add analytics?
Async analytics pipeline:
- Log click events to Kinesis (async, non-blocking)
- Firehose batches to S3 every 60 seconds
- Query with Athena for dashboards
- Click count per URL
- Geographic distribution
- Referrer analysis
- Time-based patterns
Q5: What's the total cost at scale?
Q5: What's the total cost at scale?
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
- Practice with hands-on labs
- Build your own projects
- Prepare for AWS certification
- Review interview questions regularly
Return to Course Overview
Review the complete curriculum and resources