- Job frequency: once per hour
- Runtime: ~15 minutes
- Compute requirement: ~64 vCPU, 512 GiB memory
1. AWS Lambda Cost Analysis
Lambda pricing basics:
- You pay for memory allocated × execution time.
- Lambda CPU is proportional to memory allocation, but even at maximum memory (10,240 MB), CPU is far below a dedicated 64 vCPU machine.
- This means your job cannot run on one Lambda invocation — you’d need to split it into parallel tasks.
Example scenario:
- Suppose we split into 64 parallel Lambda functions (1 vCPU each).
- Each Lambda invocation: 15 minutes × 64 functions = heavy orchestration overhead.
- Lambda cost formula:
Price = number of requests × price per request + execution time × memory allocated × price per GB-second
Quick estimate:
- Memory: max 10 GiB per Lambda
- Execution: 15 min = 900 sec
- Price per GB-sec: ~$0.00001667
- Cost per invocation: 10 GiB × 900 sec × $0.00001667 ≈ $0.15
- 64 invocations/hour → $9.60/hour purely compute cost.
- Plus orchestration overhead (Step Functions or EventBridge) adds complexity and cost.
- Also, splitting the job adds operational complexity and risk.
2. AWS Batch on EC2 Cost Analysis
EC2 pricing basics:
- Choose instance type that matches CPU/memory needs.
- Example:
m5.24xlarge
= 96 vCPU, 384 GiB RAM - Approximate On-Demand cost: ~$4.608/hour (varies by region).
- You only need instance for ~15 minutes/hour.
Cost for your job:
- Instance usage: (15/60) hours = 0.25 hours × $4.608 = ~$1.15/hour
- Batch schedules the instance only when needed (if using Spot or On-Demand with Batch), so cost is close to this estimate.
- Spot pricing can reduce cost further, possibly below $0.50/hour.
- Operational overhead is minimal — AWS Batch handles provisioning, job scheduling, and retries.
Comparison Table:
Option | Cost Estimate | Operational Overhead | Complexity |
---|---|---|---|
AWS Lambda | ~$9.60/hour + orchestration cost | High (manual orchestration, splitting job) | High |
AWS Batch on EC2 | ~$1.15/hour (On-Demand) | Low (automated orchestration) | Low |
✅ Conclusion:
AWS Batch is much cheaper for large CPU workloads and greatly reduces operational complexity. Lambda in this scenario would be significantly more expensive and much harder to manage.
Top comments (0)