Lambda Pricing Calculator
Accurate estimate of your AWS Lambda serverless costs including Free Tier logic.
Calculated based on 0 requests and 0 GB-seconds of compute.
| Component | Units | Unit Price | Total |
|---|
What is a Lambda Pricing Calculator?
A lambda pricing calculator is an essential tool for cloud architects and developers designed to estimate the monthly costs of running serverless functions on AWS. Unlike traditional server pricing, which charges a flat rate for uptime, AWS Lambda charges based on usage: specifically, the number of requests and the duration (compute time) your code executes.
Using a lambda pricing calculator helps teams predict expenses before deploying code, optimize memory configurations for cost-efficiency, and determine if a serverless architecture is cheaper than provisioned containers or EC2 instances. This tool specifically models the “Pay-as-you-go” nature of Function-as-a-Service (FaaS).
Common misconceptions include thinking you pay for “idle” time (you don’t) or that higher memory always equals higher cost (sometimes higher memory executes faster, lowering total cost).
Lambda Pricing Formula and Mathematical Explanation
The lambda pricing calculator logic is derived from two main cost components: Request charges and Compute charges. Understanding the math helps in optimizing your serverless spend.
1. Compute Charges (GB-Seconds)
Compute cost is calculated by multiplying the time your function takes to run (in seconds) by the amount of memory allocated (in Gigabytes). This unit is called a “GB-second”.
Formula: Total GB-Seconds = (Requests) × (Duration in ms / 1000) × (Memory in MB / 1024)
2. Request Charges
A flat fee is applied for every 1 million requests.
Formula: Request Cost = (Total Requests / 1,000,000) × $0.20
Variables Table
| Variable | Meaning | Unit | Typical Range |
|---|---|---|---|
| Duration | Execution time | Milliseconds (ms) | 1ms to 900,000ms (15 min) |
| Memory | Power allocated | Megabytes (MB) | 128 MB to 10,240 MB |
| Requests | Invocations | Count | 0 to Billions |
| Architecture | Processor Type | x86 or Arm | Standard vs Graviton2 |
Practical Examples of Lambda Costs
Example 1: The High-Volume API
Imagine a simple API endpoint backed by Lambda. It is lightweight but receives heavy traffic.
- Requests: 10,000,000 per month
- Duration: 100 ms
- Memory: 128 MB
- Architecture: x86
Calculation: The request fees ($2.00) would likely exceed the compute fees because the duration and memory are so low. This highlights why high-volume, low-latency APIs are very cheap on Lambda.
Example 2: Data Processing Worker
A background worker processing image uploads.
- Requests: 50,000 per month
- Duration: 5,000 ms (5 seconds)
- Memory: 2048 MB (2 GB)
Calculation: Here, the request count is low, but the GB-seconds are high due to the long duration and high memory. The compute cost will be the dominant factor in the bill.
How to Use This Lambda Pricing Calculator
- Enter Requests: Input the estimated number of times your function will be triggered in a month.
- Set Duration: Input the average execution time in milliseconds. You can find this in your AWS CloudWatch logs as “Duration”.
- Select Memory: Choose the memory allocated to your function. Remember, CPU power scales proportionally with memory in AWS Lambda.
- Toggle Free Tier: If this is a personal account or you haven’t exceeded the free tier limits elsewhere, keep this checked to see your discounted price.
- Analyze Results: Look at the “Total GB-Seconds” to understand your compute footprint. Use the chart to see if you are paying more for requests or for compute time.
Key Factors That Affect Lambda Pricing Results
Several variables can drastically change the output of a lambda pricing calculator. Being aware of these can save you money.
- Memory Provisioning: Increasing memory increases cost per second, but often decreases duration. If doubling memory halves the duration, the cost remains roughly the same, but performance improves.
- Execution Duration: AWS rounds up duration to the nearest millisecond. Writing efficient code that runs 100ms faster translates directly to savings.
- Architecture (x86 vs Arm): Switching to Arm-based Graviton2 processors usually provides up to 20% cost savings for the same duration.
- Ephemeral Storage: By default, you get 512MB of temporary storage (/tmp). Configuring more storage adds a separate cost per GB-hour not covered in standard base calculators.
- Provisioned Concurrency: If you need to avoid “cold starts,” you pay for provisioned concurrency, which adds a constant hourly cost regardless of requests.
- Data Transfer Fees: While the calculator focuses on compute, moving data out of AWS (Data Transfer Out) incurs additional bandwidth charges.
Frequently Asked Questions (FAQ)
No. This is the main benefit of serverless. You only pay when your code is actually executing (duration) or being requested.
This calculator uses standard AWS On-Demand public pricing rates (US East N. Virginia region as a baseline). Actual costs may vary slightly by region and tax jurisdiction.
The perpetual free tier includes 400,000 GB-seconds of compute time and 1 million requests per month, which applies to all AWS customers indefinitely, not just for the first 12 months.
Unless you rely on specific binary dependencies that only work on Intel x86, Arm (Graviton) is generally cheaper and performant for interpreted languages like Python, Node.js, and Java.
Yes. In AWS Lambda, CPU power is allocated linearly with memory. A 1769 MB function has the equivalent of 1 vCPU.
You are still billed for the duration the function ran until it hit the timeout limit.
For sporadic traffic or variable workloads, Lambda is usually cheaper. For constant, predictable heavy workloads, reserved EC2 instances might be more cost-effective.
Optimize your code to run faster, choose the right memory size (power tuning), and utilize the Arm architecture option.