Discover how CloudZero helps engineering and finance get on the same team — and unlock cloud cost intelligence to power cloud profitability
Learn moreDiscover the power of cloud cost intelligence
Give your team a better cost platform
Give engineering a cloud cost coach
Learn more about CloudZero and who we are
Learn more about CloudZero's pricing
Take a customized tour of CloudZero
Explore CloudZero by feature
Build fast with cost guardrails
Drive accountability and stay on budget
Manage all your discounts in one place
Organize spend to match your business
Understand your cloud unit economics and measure cost per customer
Discover and monitor your real Kubernetes and container costs
Measure and monitor the unit metrics that matter most to your business
Allocate cost and gain cost visibility even if your tagging isn’t perfect
Identify and measure your software COGS
Decentralize cost decisions to your engineering teams
Automatically identify wasted spend, then proactively build cost-effective infrastructure
Monitor your AWS cost and track progress in real-time as you move to the cloud
CloudZero ingests data from AWS, GCP, Azure, Snowflake, Kubernetes, and more
View all cost sourcesDiscover the best cloud cost intelligence resources
Browse helpful webinars, ebooks, and other useful resources
Discover the best cloud cost intelligence content
Learn how we’ve helped happy customers like SeatGeek, Drift, Remitly, and more
Check out our best upcoming and past events
Gauge the health and maturity level of your cost management and optimization efforts
Compare pricing and get advice on AWS services including EC2, RDS, ElastiCache, and more
Learn moreDiscover how SeatGeek decoded its AWS bill and measures cost per customer
Read customer storyLearn how Skyscanner decentralized cloud cost to their engineering teams
Read customer storyLearn how Malwarebytes measures cloud cost per product
Read customer storyLearn how Remitly built an engineering culture of cost autonomy
Read customer storyDiscover how Ninjacat uses cloud cost intelligence to inform business decisions
Read customer storyLearn Smartbear optimized engineering use and inform go-to-market strategies
Read customer storyThis AWS Lambda pricing guide will uncover the variables that the service uses to calculate your bill — and help you determine what you are paying for.
AWS Lambda is an event-driven compute service, which means it executes tasks automatically when triggered by a compute event. This automation also means that your Lambda costs can quickly exceed your budget. That is especially true when you're not familiar with AWS Lambda pricing.
In this guide, we’ll discuss the AWS Lambda pricing model, including how billing works, and how to optimize Lambda costs.
Table of Contents
Amazon’s Lambda service enables you to run code for nearly any type of app or backend system without the need to provision or manage servers yourself. You only need to upload your code. AWS Lambda will take care of everything your code requires to run and scale with high availability.
Because it is event-driven, AWS Lambda leverages the concept of Functions. A Lambda function is a piece of Python code (no name when defining it) that performs a specific task. The lambda (function) assesses an expression based on a given argument. You provide the lambda a value (an argument) and then supply the operation (the expression).
That code executes when specific events occur in related AWS services, for example, when an object is added in an Amazon S3 bucket.
Some call this Function-as-a-Service (FaaS). Many refer to this approach as serverless computing.
Every function, or lambda, runs in an isolated environment, complete with its own file system view and resources.
Lambda is useful for a wide range of tasks, such as:
If choosing the right resources for your serverless compute requirements is important to you, check out CloudZero Advisor for customized recommendations based on factors such as AWS service, resource type, instance type, region, pricing, and more.
So, how does AWS Lambda charge for its capabilities?
AWS Lambda charges you for the serverless compute time you use; the total time it takes your code to execute and the number of requests for your functions. There are no charges when your code is not running.
Once you package your code into Lambda functions, the service will run the function only when triggered. It then scales automatically to meet the compute demand that your workload requires. AWS Lambda can scale from handling a few requests daily to thousands per second.
Here’s how that works during operations.
AWS Lambda pricing depends on seven major factors:
The following formula will help you calculate your AWS Lambda costs in GB-seconds:
Number of executions X (Lambda memory size/1024) X (Lambda duration in milliseconds/1000) = GB-seconds
You can see an illustration of how Lambda calculates your bill from this image:
At CloudZero, we are all about breaking down costs to make sense to your business, so you understand what you're paying for. That's how you maximize performance and keep costs low without compromising other crucial factors, such as availability. So, in the next section, we’ll help you unravel these Lambda pricing factors in more detail.
The Lambda service counts a request from the time it begins to execute in response to an event notification trigger or an invoke call.
An event notification trigger may come from Amazon EventBridge, or the Amazon Simple Notification Service (SNS), while an invoke call may come from the Amazon API Gateway or through the AWS SDK (including test calls from the AWS Console).
A request lasts until it is either returned or terminated. Lambda charges per request or invocation ($/request or invoke call).
The final bill will be for the total number of requests made across all your Lambda functions.
Lambda also counts duration from the time your code starts to execute to the moment it returns or terminates, rounded to the nearest one millisecond. Duration pricing is in dollars per hour ($/hour).
However, the exact duration price you’ll pay will depend on the amount of memory you’ll allocate to your function (min 128 MB; max 10 240 MB or 1 GB). Here’s what we mean based on prices in the US East (Ohio) region:
Memory amount in MB |
Price per 1 millisecond (1 ms) for X86 CPU Architecture |
Price per 1 millisecond (1 ms) for Arm CPU Architecture |
128 |
$0.0000000021 |
$0.0000000017 |
512 |
$0.0000000083 |
$0.0000000067 |
1024 |
$0.0000000167 |
$0.0000000133 |
1536 |
$0.0000000250 |
$0.0000000200 |
2048 |
$0.0000000333 |
$0.0000000267 |
3072 |
$0.0000000500 |
$0.0000000400 |
4096 |
$0.0000000667 |
$0.0000000533 |
5120 |
$0.0000000833 |
$0.0000000667 |
6144 |
$0.0000001000 |
$0.0000000800 |
7168 |
$0.0000001167 |
$0.0000000933 |
8192 |
$0.0000001333 |
$0.0000001067 |
9216 |
$0.0000001500 |
$0.0000001200 |
10240 |
$0.0000001667 |
$0.0000001333 |
Your Lambda cost will vary depending on the amount of memory (RAM) you allocate to your function. The previous table shows how pricing changes with changes in allocated memory.
One more thing. The service automatically allocates you a proportional amount of processing power (CPU) and other resources based on the amount of memory you allocate your function. That means increasing your Lambda memory size triggers an equivalent increase in CPU power available to your function.
Ephemeral storage pricing starts at $0.0000000309 per GB-second. You can allocate between 512 MB and 10 240 MB of ephemeral storage to your function, and its execution duration (in milliseconds). 512 MB comes complementary and both X86 and ARM architectures are supported.
You only pay extra for additional ephemeral storage, which you can increase in 1 MB increments.
Provisioned concurrency is a Lambda feature that seeks to reduce startup latency. When active, provisioned concurrency keeps your functions initialized and ready to respond to requests from your workload in double-digit milliseconds.
Some things to note here are that you:
There’s just one more billable consideration.
Additional charges may apply for the following:
When data is transferred into and out of AWS Lambda functions from locations outside the region where the function is running, expect charges at the Amazon EC2 data transfer rates below.
This option enables you to improve performance and reduce latency by running your code closer to your users using AWS CloudFront. Prices are $0.60 per 1 million requests or $0.0000006 per request and $0.00005001 per GB-second you use.
Say you allocate 128 MB of memory for each execution of your Lambda@Edge function. Then your duration cost will be $0.00000625125 per 128 MB-second you use, measured in 1 ms intervals.
Here are some final thoughts (and hopefully some clarification on the prices discussed in the previous section).
Each month, Lambda offers 1 million requests and 400,000 GB-seconds of compute for free. Subtract this free allowance from your monthly total requests and code execution time to calculate your billable balance.
For usage above the free allowance, a $0.20 fee applies per 1 million requests, and a $0.0000000167 fee applies per 1024 MB-second (1 GB-second) of execution time. While pricing for requests is constant, duration pricing will vary based on the amount of memory you allocate to your function. See the chart in “How does code execution duration affect AWS Lambda pricing” above.
With AWS Lambda, you can take advantage of discounted compute rates (up to 17% off) by committing to a certain amount of usage over one or three years. Compute Savings Plans are ideal for consistent workloads and apply to Duration, Duration (with Provisioned Concurrency), and Provisioned Concurrency.
As you can tell, there are quite a number of factors that affect AWS Lambda pricing. You do not want these to catch you off guard when not paying close attention during account setup and budgeting.
For that reason, here are some tips to look out for to help you control your AWS Lambda costs.
If your AWS Lambda requests are involved in any way with a different AWS service, you’ll be charged for both services. The additional charges are based on the prices of the specific AWS services you use. For example, when your functions write to or read data from Amazon S3, you’ll be billed for the requests and any data that’ll be stored in S3.
You can set the maximum size of the memory and the maximum execution time for each Lambda function. Your function automatically gets more CPU power the more memory you provide.
AWS designed Graviton2 processors based on Arm processor architecture to deliver up to 34% better price performance versus running Lambda functions on x86 processors. Some applicable use cases here include serverless workloads like data and media processing, serverless websites, and mobile backends.
You can specify limitations for the amount of CPU, memory, and storage resources that serverless functions can use. Several resources are subject to these limits, including:
Here’s something else.
You allocate this amount of memory to your function through the AWS console. However, this isn't actually how much memory the function uses. It follows then that reducing your function's memory usage without tweaking this configuration may not yield much cost savings.
Functions take a certain amount of time to execute their code logic. Here is the thing. When a function makes an outgoing call and waits for the response, the Lambda service counts the idle time in-between as part of the function's execution time.
CloudZero Advisor provides customized insights about the best resources for your AWS Lambda projects. Among the factors it considers are pricing, AWS services, resource type, and AWS region. You can use CloudZero Advisor to determine whether an X86 or Arm-based CPU is right for your serverless computing, for example. Learn more about CloudZero Advisor here.
Depending on the size of your operation, calculating AWS Lambda costs can be challenging. AWS Lambda costs can pile up quickly, probably before you can pinpoint what you're paying for. Plus, traffic can vary greatly from hour to hour, day to day, week to week, and month to month.
It's also a bad idea to wait until the end of the month to see your Lambda bill because there's no way to change it by then. Perhaps you experienced some cost spikes that you didn't notice until the bill arrived, and you can't figure out why they occurred or how you can prevent them in the future.
This is where CloudZero can help.
With CloudZero, you can capture, analyze, and present your AWS costs per unit for business concepts you actually care about, such as:
With this intelligence at your fingertips, you can pinpoint exactly who, what, and why your AWS costs are changing. The majority of other tools show you total costs and averages — not this level of instantly actionable cost insight.
Also, CloudZero detects cost anomalies in real-time.
CloudZero then alerts individual engineers or your entire FinOps team via Slack or email to the anomalies, so you can stop the bleeding before it wipes out your budget.
With CloudZero, you can also forecast and budget costs, analyze Kubernetes costs, and consolidate costs from AWS, Google Cloud, and Azure in one platform. Our customers, like Drift, have already reduced their annual AWS spending by $2.4 million. You can too.
to see how you can optimize your costs as well.
The following are answers to frequently asked questions about AWS Lambda pricing.
You pay per use. If your code isn't running, there are no charges to you.
AWS Lambda charges you for the serverless compute time you use; the total time it takes your code to execute and the number of requests for your functions.
Several variables determine Lambda costs, including the type of CPU architecture (Arm-based or X86), the number of requests, the time frame (code/function execution duration), the duration of each request (measured in milliseconds), and the amount of memory you allocate it (in GB-seconds).
EC2 pricing may appear lower and more straightforward than Lambda pricing on the surface. Depending on your use case, this may vary. The Lambda service eliminates many of the costs associated with provisioning and managing your own servers, as one example.
Also, unlike EC2 instances, AWS Lambda functions terminate as soon as they finish executing a task, instead of incurring charges for idle time.
CloudZero is the only solution that enables you to allocate 100% of your spend in hours — so you can align everyone around cost dimensions that matter to your business.