← Back to Blog

March 15, 2025

AWS Lambda Cost Optimization: Memory, Duration, and Concurrency

8 min read

Lambda pricing is based on memory allocation and execution time. Most functions are over-provisioned, leading to unnecessary costs.

We've helped teams reduce Lambda costs by 40% by optimizing memory allocation and reducing cold starts.

Optimization strategies

  1. Right-size memory: Test different memory settings and pick the one that minimizes cost per request.
  2. Reduce cold starts: Use provisioned concurrency for critical functions, or switch to containers.
  3. Optimize code: Reduce execution time by caching dependencies and minimizing I/O.
  4. Monitor concurrency: High concurrency can trigger throttling and increase costs.

Sonar tracks Lambda costs per function and suggests optimal memory settings based on actual usage.