This document summarizes a company's journey to migrating their API from traditional servers to AWS Lambda. Some key points covered include:
- The company decided to move to serverless to reduce costs and management overhead
- They used the aws-serverless-express library to run their Express app on Lambda
- This provided a standard development process while avoiding vendor lock-in
- The document outlines several limitations to consider like package size limits and cold starts
- It provides examples of strategies used to address issues like keeping Lambdas warm and moving static assets to S3
4. AOL + Yahoo, owned by Verizon
Media and technology company
Reach over 2 billion mobile devices
Deliver over 1 billion hours of video each year
Over one trillion ad requests processed each month
HuffPost is the most shared site on Facebook
TechCrunch is the most followed tech publication on Twitter
4
Oath
5. How we landed on AWS Lambda
Technology stack
Limitations
5
Agenda
8. New flexible system to support any type of ads
Improved development of templates
Integrated into other systems within the company
Low load expected (1000s a day)
8
New API
11. Pay when it runs (no EC2 instances with low utilization)
Function or a zip (or binary file for other languages)
No server management
Free tier (forever): 1M requests/month, 400 000 seconds (1 GB RAM)
11
AWS Lambda
22. Stores files by keys - they form sort of directories
Relatively cheap
$0.023 per GB
Reads $0.0004 per 1,000 requests
Writes $0.005 per 1,000 requests
Transfers $0.09 per GB, first GB free
22
S3
23. API Gateway 10 MB maximum payload
Lambda 6 MB
23
File upload limit
28. Lambda container is shut down when idle for ~15 mins
Takes around around 10s to start (worse for other languages)
Job that makes request every 10 mins to keep Lambda alive
CloudWatch Events - every 5 mins
You cannot avoid random shutdowns
28
Lambda cold starts
29. Lambda is not good for serving apps with many subsequent requests
Swagger static assets moved to S3
This drastically improved response time
29
Static assets
37. Lambda shuts down when idle
30s API Gateway execution timeout
API Gateway 10 MB maximum payload, Lambda 6 MB
Deployment package up to 50 MB, 250 MB via S3, 75 GB total per region
CloudFront URL size limit of 8192 bytes, 20K including headers
DynamoDB 1 MB limit on retrieved data
DynamoDB 400 KB maximum item size
37
Summary of limitations
38. No server management when using AWS Lambda
Using Express and aws-serverless-express prevents vendor lock-in
Cost effective solution for non-heavy traffic API
Relational DB might often be better option than NoSQL
38
Result