Overview

Understand the AWS Lambda pricing model and discover quick-win optimization strategies to cut request and duration costs.

Pricing Model

Lambda charges based on:

  • Requests: $0.20 per 1M requests
  • Duration: $0.0000166667 per GB-second

Cost Calculation

Cost = (Requests × $0.20/1M) + (Memory GB × Duration seconds × Requests × $0.0000166667)

Example

1M invocations, 512MB memory, 200ms average:

  • Request cost: $0.20
  • Duration cost: (0.5GB × 0.2s × 1M × $0.0000166667) = $1.67
  • Total: $1.87/month

Pricing here is illustrative—actual Lambda prices vary by region and over time, so always confirm with the current AWS pricing page.

Quick Wins

  1. Compute Savings Plans - Commit to baseline usage for automatic compute discounts (no code changes).
  2. Switch to Graviton - Switch runtimes/architectures to arm64 for better price-performance (may require rebuilding native deps).
  3. Right-size memory - Use the Lambda Power Tuning tool to pick the cheapest memory setting that still meets latency goals.
  4. Cost-Effective Log Storage - Define log retention and archive plans in IaC so CloudWatch Logs don’t grow unbounded and older data moves to cheaper storage.
  5. Event Filtering - Configure event filtering on queues/streams so Lambda only runs for relevant records instead of every message.

Resources