Understanding AWS Lambda Pricing: A Simple Guide


AWS Lambda has revolutionized how we deploy applications by letting developers run code without managing servers. One of its most attractive features is its cost-effective pricing model. Let's break down how AWS Lambda pricing works in simple terms.
The Two Components of Lambda Pricing
AWS Lambda's pricing is based on two main factors:
The number of requests your function receives
The duration and memory your function uses
Request Pricing
Think of requests as how many times someone "knocks on your function's door." Here's what you get:
Your first 1 million requests each month are completely free
After that, you pay $0.20 for every million requests
In other words, each request after the free tier costs $0.0000002
This means if your application gets 2 million requests in a month, you'll only pay $0.20 for the second million requests.
Duration Pricing
Duration pricing is about how long your function runs and how much memory it uses. AWS measures this in GB-seconds (gigabyte-seconds). Here's the breakdown:
Free Tier: 400,000 GB-seconds per month
After the free tier: $1.00 for every 600,000 GB-seconds
To understand GB-seconds better, here are some examples:
If your function uses 1GB of memory, you get 400,000 seconds free
If your function uses only 128MB of memory, you get 3,200,000 seconds free (8 times more because it uses 1/8 of the memory)
Why Lambda Is Cost-Effective
AWS Lambda is popular because of its economical pricing model. Here's why:
You only pay for what you use, down to the millisecond
The generous free tier covers many small applications entirely
There are no charges when your function isn't running
You can optimize costs by adjusting memory allocation
Cost Example
Let's say you have a function that:
Receives 2 million requests per month
Uses 256MB of memory
Runs for 1 second per request
Your monthly cost would be:
Requests: $0.20 (first million free, pay for second million)
Duration: Likely within free tier (2 million seconds at 256MB = 500,000 GB-seconds)
Total: Approximately $0.20 per month
Tips for Cost Optimization
Monitor your function's memory usage and duration
Adjust memory settings to find the sweet spot between performance and cost
Use the AWS Lambda Power Tuning tool to optimize your functions
Take advantage of the free tier by distributing workloads across multiple functions
Conclusion
AWS Lambda's pricing model makes it an excellent choice for many applications, especially those with variable workloads. The combination of a generous free tier and pay-per-use pricing means you can run many applications at minimal cost. As your application grows, the costs scale gradually and predictably.
Remember: Lambda is generally very cost-effective compared to running traditional servers, making it a popular choice for modern applications.
Subscribe to my newsletter
Read articles from Gedion Daniel directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Gedion Daniel
Gedion Daniel
I am a Software Developer from Italy.