0
0
AWScloud~10 mins

Lambda pricing model in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Lambda pricing model
Request triggers Lambda
Count number of requests
Measure execution duration
Calculate GB-seconds used
Apply free tier if eligible
Calculate cost based on requests + duration
Generate billing amount
This flow shows how AWS Lambda pricing is calculated step-by-step from requests and execution time to final billing.
Execution Sample
AWS
Requests = 3,000,000
Duration = 200 ms
Memory = 512 MB

Calculate GB-seconds and cost
Calculates cost for 3 million Lambda requests with 200 ms duration and 512 MB memory.
Process Table
StepMetricValueCalculationResult
1Requests3,000,000Count total requests3,000,000
2Duration per request200 msGiven0.2 seconds
3Memory allocated512 MBGiven0.5 GB
4Total compute (GB-seconds)3,000,000 * 0.2 * 0.53,000,000 * 0.1300,000 GB-seconds
5Free tier requests1,000,000Subtract free tier2,000,000 billable requests
6Free tier compute400,000 GB-secondsSubtract free tier300,000 - 400,000 = 0 (free tier covers all)
7Billable compute0No charge for compute0 GB-seconds
8Request cost2,000,0002,000,000 / 1,000,000 * $0.20$0.40
9Compute cost0 GB-seconds0 * $0.0000166667$0.00
10Total cost-$0.40 + $0.00$0.40
💡 Free tier covers all compute usage; only requests beyond free tier are charged.
Status Tracker
VariableStartAfter Step 4After Step 6Final
Requests3,000,0003,000,0002,000,0002,000,000
Duration (seconds)0.20.20.20.2
Memory (GB)0.50.50.50.5
Compute (GB-seconds)N/A300,00000
Request Cost ($)N/AN/AN/A0.40
Compute Cost ($)N/AN/AN/A0.00
Total Cost ($)N/AN/AN/A0.40
Key Moments - 3 Insights
Why is the compute cost zero even though there is compute usage?
Because the free tier includes 400,000 GB-seconds, which covers the 300,000 GB-seconds used (see step 6 in execution_table). So no compute charges apply.
Why do we subtract 1,000,000 requests in step 5?
AWS Lambda offers 1 million free requests per month. We subtract this free tier from total requests to find billable requests (step 5).
How is the total compute (GB-seconds) calculated?
Multiply number of requests by duration in seconds and memory in GB (step 4). Here: 3,000,000 * 0.2 * 0.5 = 300,000 GB-seconds.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 4. What is the total compute in GB-seconds?
A600,000
B300,000
C150,000
D3,000,000
💡 Hint
Check the 'Result' column in step 4 of execution_table.
At which step does the free tier reduce the billable compute to zero?
AStep 6
BStep 5
CStep 7
DStep 8
💡 Hint
Look for where compute usage is adjusted by free tier in execution_table.
If the number of requests was 500,000 instead of 3,000,000, what would be the billable requests?
A500,000
B1,000,000
C0
D2,000,000
💡 Hint
Refer to step 5 where free tier requests are subtracted from total requests.
Concept Snapshot
AWS Lambda pricing is based on two parts:
- Number of requests (first 1M free, then $0.20 per million)
- Compute time in GB-seconds (memory GB * execution seconds)
Free tier covers 1M requests and 400,000 GB-seconds monthly.
Charges apply only beyond free tier.
Calculate total cost = request cost + compute cost.
Full Transcript
AWS Lambda pricing works by counting how many times your function runs and how long it runs with how much memory. Each request counts, and each second of execution with allocated memory counts as GB-seconds. AWS gives you a free tier of 1 million requests and 400,000 GB-seconds per month. You pay only for what you use beyond that. For example, if you run 3 million requests with 512 MB memory and 200 ms duration, you calculate total GB-seconds by multiplying requests, duration in seconds, and memory in GB. Then subtract free tier amounts. The remaining billable requests and compute are multiplied by their rates to get the total cost. This step-by-step calculation helps you understand your Lambda bill clearly.