AWS Lambda vs Cloud Run: Serverless Comparison 2024
The section below covers Technical Specifications.
Technical Specifications
| Feature | AWS Lambda | Google Cloud Run |
|---|---|---|
| Memory | 128MB - 10GB | 128MB - 32GB |
| CPU | 1-6 vCPUs | 1-8 vCPUs |
| Timeout | 15 minutes | 60 minutes |
| Package Size | 50MB (zipped) | No limit (container) |
| Cold Start | 100ms - 1s | 100-400ms |
Pricing Comparison (US regions)
| Metric | AWS Lambda | Google Cloud Run |
|---|---|---|
| Compute | $0.0000166667/GB-second | $0.00002400/vCPU-second |
| Memory | $0.0000000167/GB-second | $0.00000250/GiB-second |
| Requests | $0.20/million requests | $0.40/million requests |
| Free Tier | 1M requests/month | 2M requests/month |
Quick Decision Guide
Choose AWS Lambda if you:
- Need tight AWS ecosystem integration
- Have short-running tasks (<15 minutes)
- Require fine-grained scaling
Choose Cloud Run if you:
- Need container flexibility
- Have longer-running processes
- Want simpler deployment workflows
Code Examples
# AWS Lambda Example
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': 'Hello from Lambda!'
}
# Cloud Run Example (Flask)
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello from Cloud Run!'
Migration Considerations
From Lambda to Cloud Run
- Container adaptation steps
- Authentication changes
- Monitoring adjustments
From Cloud Run to Lambda
- Function packaging
- Memory optimization
- Trigger equivalents
Additional Resources
Note: Pricing and specifications are as of February 2024. Check provider documentation for current information.