Overview
AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. Create workload-aware cluster scaling logic, maintain event integrations, and manage runtimes with ease. With Lambda, you can run code for virtually any type of application or backend service, all with zero administration, and only pay for what you use. You are charged based on the number of requests for your functions and the duration it takes for your code to execute.
Lambda counts a request each time it starts executing in response to an event notification trigger, such as from Amazon Simple Notification Service (SNS) or Amazon EventBridge, or an invoke call, such as from Amazon API Gateway, or via the AWS SDK, including test invokes from the AWS Console.
Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 1 ms*. The price depends on the amount of memory you allocate to your function. In the AWS Lambda resource model, you choose the amount of memory you want for your function, and are allocated proportional CPU power and other resources. An increase in memory size triggers an equivalent increase in CPU available to your function. To learn more, see the Function Configuration documentation.
You can run your Lambda functions on processors built on either x86 or Arm architectures. AWS Lambda functions running on Graviton2, using an Arm-based processor architecture designed by AWS, deliver up to 34% better price performance compared to functions running on x86 processors. This applies to a variety of serverless workloads, such as web and mobile backends, data, and media processing.
* Duration charges apply to code that runs in the handler of a function as well as initialization code that is declared outside of the handler. For Lambda functions with AWS Lambda Extensions, duration also includes the time it takes for code in the last running extension to finish executing during shutdown phase. For Lambda functions configured with SnapStart, duration also includes the time it takes for the runtime to load, any code that runs in a runtime hook, and the initialization code executed during creation of copies of snapshots created for resilience. For more details, see the Lambda Programming Model documentation.
The AWS Lambda free tier includes one million free requests per month and 400,000 GB-seconds of compute time per month, usable for functions powered by both x86, and Graviton2 processors, in aggregate. Additionally, the free tier includes 100GiB of HTTP response streaming per month, beyond the first 6MB per request, which are free. Lambda also offers tiered pricing options for on-demand duration above certain monthly usage thresholds. AWS Lambda participates in Compute Savings Plans, a flexible pricing model that offers low prices on Amazon Elastic Compute Cloud (Amazon EC2), AWS Fargate, and Lambda usage, in exchange for a commitment to a consistent amount of usage (measured in $/hour) for a one- or three-year term. With Compute Savings Plans, you can save up to 17 percent on AWS Lambda. Savings apply to duration and Provisioned Concurrency. Learn more »
AWS Pricing Calculator
Calculate your AWS Lambda and architecture cost in a single estimate.
AWS Lambda Pricing
Duration cost depends on the amount of memory you allocate to your function. You can allocate any amount of memory to your function between 128 MB and 10,240 MB, in 1 MB increments. The table below contains a few examples of the price per 1 ms associated with different memory sizes, for usage falling within the first pricing tier – for example, up to 6 billion GB-seconds / month in US East (Ohio).
-
x86 Price
-
Arm Price
-
x86 Price
-
-
Arm Price
-
Lambda on-demand duration pricing tiers are applied to aggregate monthly duration of your functions running on the same architecture (x86 or Arm, respectively), in the same region, within the account. If you’re using consolidated billing in AWS Organizations, pricing tiers are applied to the aggregate monthly duration of your functions running on the same architecture, in the same region, across the accounts in the organization.
Lambda Ephemeral Storage Pricing
Ephemeral storage cost depends on the amount of ephemeral storage you allocate to your function, and function execution duration, measured in milliseconds. You can allocate any additional amount of storage to your function between 512 MB and 10,240 MB, in 1 MB increments. You can configure ephemeral storage for functions running on both x86 and Arm architectures. 512 MB of ephemeral storage is available to each Lambda function at no additional cost. You only pay for the additional ephemeral storage you configure.
All examples below are based on price in US East (N. Virginia).
-
Example 1: Mobile application backend
Let’s assume you are a mobile app developer building a food ordering app. Customers can use the app to order food from a specific restaurant location, receive order status updates, and pick up the food when the order is ready. Because you expect high variation in demand, both by time of day and restaurant location, you build your mobile backend using serverless services, including AWS Lambda.Let’s assume you are a mobile app developer building a food ordering app. Customers can use the app to order food from a specific restaurant location, receive order status updates, and pick up the food when the order is ready. Because you expect high variation in demand, both by time of day and restaurant location, you build your mobile backend using serverless services, including AWS Lambda.For simplicity, let’s assume your application processes three million requests per month. The average function execution duration is 120 ms. You have configured your function with 1536 MB of memory, on an x86 based processor. Your charges would be calculated as follows:
Monthly compute charges
The monthly compute price is $0.0000166667 per GB-s and the free tier provides 400,000 GB-s.
Total compute (seconds) = 3 million * 120ms = 360,000 seconds
Total compute (GB-s) = 360,000 * 1536MB/1024 MB = 540,000 GB-s
Total compute – Free tier compute = monthly billable compute GB- s
540,000 GB-s – 400,000 free tier GB-s = 140,000 GB-s
Monthly compute charges = 140,000 * $0.0000166667 = $2.33Monthly request charges
The monthly request price is $0.20 per one million requests and the free tier provides 1 million requests per month.
Total requests – Free tier requests = monthly billable requests
3 million requests – 1 million free tier requests = 2 million monthly billable requests
Monthly request charges = 2M * $0.2/M = $0.40Total monthly charges
Total charges = Compute charges + Request charges = $2.33 + $0.40 = $2.73 per month
-
Example 2: Enriching streaming telemetry with additional metadata
Let’s say you are a logistics company with a fleet of vehicles in the field, each of which are enabled with sensors and 4G/5G connectivity to emit telemetry data into an Amazon Kinesis Data Stream. You want to use machine learning (ML) models you’ve developed to infer the health of the vehicle and predict when maintenance for particular components might be required.Let’s say you are a logistics company with a fleet of vehicles in the field, each of which are enabled with sensors and 4G/5G connectivity to emit telemetry data into an Amazon Kinesis Data Stream. You want to use machine learning (ML) models you’ve developed to infer the health of the vehicle and predict when maintenance for particular components might be required.Suppose you have 10,000 vehicles in the field, each of which is emitting telemetry once an hour in a staggered fashion with sufficient jitter. You intend to perform this inference on each payload to ensure vehicles are scheduled promptly for maintenance and ensure optimal health of your vehicle fleet.
Assume the ML model is packaged along with the function and is 512 MB in size. For inference, you’veconfigured your function with 1 GB of memory, and function execution takes two seconds to complete on average on an x86 based processor.
Monthly request charges:
Per month, the vehicles will emit 10,000 * 24 * 31 = 7,440,000 messages which will be processed by the Lambda function.Monthly request charges → 7.44M * $0.20/million = $1.488 ~= $1.49
Monthly compute charges:
Per month, the functions will be executed once per message for two seconds.Monthly compute duration (seconds) → 7.44 million * 2 seconds = 14.88 million seconds
Monthly compute (GB-s) → 14.88M seconds * 1024 MB/1024 MB = 14.88 GB-s
Monthly compute charges → 14.88M GB-s * $0.0000166667 = $248.00Total monthly charges:
Monthly total charges = Request charges + Compute charges = $1.49 + $248.00 = $249.49 -
Example 3: Performing ML on customer support tickets and interactions to improve customer experience
Let’s assume you are a financial services company looking to better understand your top customer service issues. Your goal is to improve the customer experience and reduce customer churn. Your customers can chat live with your customer support staff via the mobile app you provide. You decide to deploy a natural language processing (NLP) model.Let’s assume you are a financial services company looking to better understand your top customer service issues. Your goal is to improve the customer experience and reduce customer churn. Your customers can chat live with your customer support staff via the mobile app you provide. You decide to deploy a natural language processing (NLP) model.In this case, you are using the popular Bidirectional Encoder Representations from Transformers (BERT) model in AWS Lambda. The model helps you parse, analyze, and understand the customer service interactions via the mobile app in order to display relevant support content or route the customer to the appropriate customer service agent. The number of support inquiries your inference model processes varies widely throughout the week.
Let’s assume your functions running the inference model receive six million requests per month. The average function execution duration is 280 ms. You configure your function with 4096 MB of memory on an x86 based processor.
You also configure your function to use 2048 MB of ephemeral storage.
Your charges would be calculated as follows:
Monthly compute charges:
The monthly compute price is $0.0000166667 per GB-s and the free tier provides 400,000 GB-s.
Total compute (seconds) = 6M * 280ms = 1,680,000 seconds
Total compute (GB-s) = 1,680,000 * 4096 MB/1024 MB = 6,720,000 GB-s
Total compute – AWS Free Tier compute = Monthly billable compute GB- s
6,720,000 GB-s – 400,000 free tier GB-s = 6,320,000 GB-s
Monthly compute charges = 6,320,000 * $0.0000166667 = $105.33Monthly request charges:
The monthly request price is $0.20 per one million requests and the free tier provides one million requests per month.
Total requests – Free tier requests = monthly billable requests
6 million requests – 1 million free tier requests = 5 million monthly billable requests
Monthly request charges = 5 million * $0.2/million = $1Monthly ephemeral storage charges:
The monthly ephemeral storage price is $0.0000000309 for every GB-second and Lambda provides 512 MB of storage at no additional cost.
Total compute (seconds) = 6M * 280ms = 1,680,000 seconds
Total billable ephemeral storage = 2048 MB – 512 MB = 1536 MB
Total ephemeral storage (GB-s) = 1,680,000 * 1536 MB/1024 MB = 2,520,000 GB-s
Monthly ephemeral storage charges = 2,520,000 * $0.0000000309 = $0.08Total monthly charges:
Total charges = Compute charges + Request charges = $105.33 + $1 + $0.08 = $106.41 per month
Provisioned Concurrency Pricing
Enable Provisioned Concurrency for your Lambda functions for greater control over your serverless application performance. When enabled, Provisioned Concurrency keeps functions initialized and hyper-ready to respond in double-digit milliseconds. You pay for the amount of concurrency you configure, and for the period of time you configure it. When Provisioned Concurrency is enabled and executed for your function, you also pay for Requests and Duration based on the prices below. If your function exceeds the configured concurrency, you will be billed for excess function execution at the rate outlined in the AWS Lambda Pricing section above. You can enable Provisioned Concurrency for functions running on both the x86 and Arm architectures. To learn more about Provisioned Concurrency, read the documentation.
Provisioned Concurrency is calculated from the time you enable it on your function until it is disabled, rounded up to the nearest five minutes. The price depends on the amount of memory you allocate to your function and the amount of concurrency that you configure on it. Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 1ms**. The price depends on the amount of memory you allocate to your function.
** Duration charges apply to code that runs in the handler of a function as well as initialization code that is declared outside of the handler. For Lambda functions with AWS Lambda Extensions, duration also includes the time it takes for code in the last running extension to finish executing during shutdown phase. For functions configured with Provisioned Concurrency, AWS Lambda periodically recycles the execution environments and re-runs your initialization code. For more details, see the Lambda Programming Model documentation.
The Lambda free tier does not apply to functions enabling Provisioned Concurrency. If you enable Provisioned Concurrency for your function and execute it, you will be charged for Requests and Duration based on the price below.
All examples below are based on price in US East (N. Virginia).
-
Example 1: Mobile application launch
Let’s assume you are a mobile app developer and are building a food ordering mobile application. Customers can use the application to order food from a specific restaurant location, receive order status updates, and pick up the food when the order is ready. Because you expect high variation in your application demand, both by time of day and restaurant location, you build your mobile backend using serverless services, including AWS Lambda.Let’s assume you are a mobile app developer and are building a food ordering mobile application. Customers can use the application to order food from a specific restaurant location, receive order status updates, and pick up the food when the order is ready. Because you expect high variation in your application demand, both by time of day and restaurant location, you build your mobile backend using serverless services, including AWS Lambda.For simplicity, let’s assume your application processes three million requests per month. The
average function execution duration is 120 ms. You have configured your function with 1536 MB of memory on an x86 based processor.You are launching the new version of your mobile app, which you have heavily marketed. You expect a spike in demand during launch day, from noon to 8 p.m. You want your mobile app to be responsive even while demand scales up and down quickly, so you enable Provisioned Concurrency on your Lambda functions. You set Provisioned Concurrency to 100.
During these eight hours, your functions received 500,000 requests. The average function
execution duration while Provisioned Concurrency is enabled is 100 ms. During the rest of the month, your application receives the additional 2.5 million requests, and your functions execute in response to them without Provisioned Concurrency enabled.Your charges would be calculated as follows:
Provisioned Concurrency charges:
The Provisioned Concurrency price is $0.0000041667 per GB-s
Total period of time for which Provisioned Concurrency is enabled (seconds): 8 hours * 3,600 seconds = 28,800 seconds
Total concurrency configured (GB): 100 * 1536MB/1024MB = 150 GB
Total Provisioned Concurrency amount (GB-s): 150 GB * 28,800 seconds =4,320,000 GB-s
Provisioned Concurrency charges: 4.32M GB-s * $0.0000041667 = $18Request charges:
The monthly request price is $0.20 per 1 million requests and the free tier provides 1M requests per month.
Total requests – Free tier requests = Monthly billable requests
3,000,000 requests – 1M free tier requests = 2,000,000 Monthly billable requests
Monthly request charges = 2 * $0.20 = $0.40Compute charges while Provisioned Concurrency is enabled:
The compute price is $0.0000097222 per GB-s
Total compute duration (seconds) = 500,000 * 100ms = 50,000 seconds
Total compute (GB-s) = 50,000 seconds * 1536 MB / 1024 MB = 75,000 GB-s.
Total compute charges = 75,000 GB-s * $0.0000097222 = $0.73
Compute charges while Provisioned Concurrency is disabled:
The monthly compute price is $0.0000166667 per GB-s and the free tier provides 400,000 GB-s.
Total compute (seconds) = 2.5M * 120ms = 300,000 seconds
Total compute (GB-s) = 300,000 * 1536 MB / 1024 MB = 450,000 GB-s
Total compute – Free tier compute = Monthly billable compute GB- s
450,000 GB-s – 400,000 free tier GB-s = 50,000 GB-s
Monthly compute charges = 50,000 * $0.0000166667 = $0.83
Total monthly charges:
Total charges = Provisioned Concurrency charges + Request charges + Compute charges while Provisioned Concurrency is enabled + Compute charges while Provisioned Concurrency is disabled
Total charges = $18 + $0.40 + $0.73 + $0.83 = $19.96
-
Example 2 : Routing customers to the most relevant support solution content during Cyber Monday
Let’s assume you are a retailer running a large sale during Cyber Monday, an ecommerce holiday that takes place the Monday after Thanksgiving in the United States. Your customers can chat live with customer support via the mobile app you provide. You decide to deploy a natural language processing (NLP) model.Let’s assume you are a retailer running a large sale during Cyber Monday, an ecommerce holiday that takes place the Monday after Thanksgiving in the United States. Your customers can chat live with customer support via the mobile app you provide. You decide to deploy a natural language processing (NLP) model.In this case, you are using the popular Bidirectional Encoder Representations from Transformers (BERT) model in AWS Lambda. The model helps you parse, analyze, and understand customer service interactions via the mobile app in order to display relevant support content or route the customer to the appropriate customer service agent. You will receive significantly more customer support inquiries during this sale than usual, so you decide to enable Provisioned Concurrency on your Lambda functions so your application responds quickly even while experiencing traffic spikes.
Let’s assume your functions receive two million requests during the 24 hours of the sale event, while Provisioned Concurrency is enabled. The average function execution duration is 280 ms. You configure your function with 4,096 MB of memory on an x86 based processor, and set Provisioned Concurrency at seven.
Your charges would be calculated as follows:
Provisioned Concurrency charges:
The Provisioned Concurrency price is $0.0000041667 per GB-s.
Total period of time for which Provisioned Concurrency is enabled (seconds) = 24 hours * 3,600 seconds = 86,400 seconds
Total concurrency configured (GB): 7 * 4096 MB / 1024 MB = 28 GB
Total Provisioned Concurrency amount (GB-s) = 28 GB * 86,400 seconds = 2,419,200 GB-s
Provisioned Concurrency charges = 2,419,200 GB-s * $0.0000041667 = $10.08Compute charges while Provisioned Concurrency is enabled:
The compute price is $0.0000097222 per GB-s.
Total compute duration (seconds) = 2,000,000 * 280ms = 560,000 seconds
Total compute (GB-s) = 560,000 seconds * 4096 MB / 1024 MB = 2,240,000 GB-s.
Total compute charges = 2,240,000 GB-s * $0.0000097222 = $21.78Monthly request charges:
The monthly request price is $0.20 per 1 million requests
Monthly request charges = 2M * $0.2/M = $0.40Total monthly charges:
Total charges = Provisioned Concurrency charges + Compute charges while Provisioned Concurrency is enabled + Request charges = $10.08 + $21.78 + $0.40 = $32.26
SnapStart Pricing
A snapshot is created each time you publish a new version of your function with SnapStart enabled. You are charged for caching a snapshot over the period that your function version is active, for a minimum of 3 hours and per millisecond thereafter. The price depends on the amount of memory you allocate to your function. You are also charged each time Lambda resumes an execution environment by restoring your snapshot, with the price depending on the amount of memory you allocate to your function.
SnapStart pricing does not apply to supported Java managed runtimes.
-
Pricing Example: Enriching streaming telemetry with additional metadata
Let’s say you are a logistics company with a fleet of vehicles in the field, each of which are enabled with sensors and 4G/5G connectivity to emit telemetry data into an Amazon Kinesis Data Stream. You want to use machine learning (ML) models you’ve developed to infer the health of the vehicle and predict when maintenance for particular components might be required.
Suppose you have 10,000 vehicles in the field, each of which is emitting telemetry once an hour in a staggered fashion with sufficient jitter. You intend to perform this inference on each payload to ensure vehicles are scheduled promptly for maintenance and ensure optimal health of your vehicle fleet.
Assume the ML model is packaged along with the function and is 512 MB in size. For inference, you’ve configured your function with 1 GB of memory, and billed execution duration is two seconds on average, on an x86 based processor. You maintain a single version of your function. For simplicity, let’s assume that 1% of all requests result in the creation of new execution environments.
You notice that end-to-end processing takes several seconds for these 1% of requests. This is driven by your function initialization taking several seconds, because you import large software modules and the ML model during initialization. You want to reduce the end-to-end processing time for these requests, so you enable SnapStart on your function and publish a new version.
Your charges would be calculated as follows:
Request charges
Per month, the vehicles will emit 10,000 * 24 * 31 = 7,440,000 messages which will be processed by the Lambda function.Monthly request charges: 7.44M * $0.20/million = $1.49
Monthly compute charges
Per month, your function will be executed once per message for two seconds.Monthly compute duration (seconds): 7.44 million * 2 seconds = 14.88 million seconds
Monthly compute (GB-s): 14.88M seconds * 1024 MB/1024 MB = 14.88M GB-s
Monthly compute charges: 14.88M GB-s * $0.0000166667 = $248.00SnapStart charges:
Total time period over which function version is active (seconds): 24 hours * 31 days * 3600 seconds = 2,678,400 seconds
Allocated function memory: 1024MB/1024MB -> 1 GB
Total SnapStart Cache used: 1 GB * 2,678,400 s -> 2,678,400 GB-S
SnapStart Cache charges: 2.68 million GB-s * $0.0000015046 = $4.03Number of requests using SnapStart Restore: 1% of 7.44M = 74,400
Total SnapStart Restore used: 74,400 * 1 GB = 74,400 GB
SnapStart Restore charges: 74,400 GB * $0.0001397998 = $10.4Total SnapStart charges: SnapStart Cache charges + SnapStart Restore charges
Total SnapStart charges: $4.03 + $10.4 = $14.43Total monthly charges
Total charges = Request charges + Compute charges + SnapStart charges
Total charges = $1.49 + $248.00 + $14.43 = $263.92
Lambda HTTP Response Stream Pricing
All examples below are based on price in US East (N. Virginia).
-
Pricing Example: Streaming Server Side Rendered Web Content
Let’s assume you are a web application developer and are building a website that is server side rendered in a Lambda function. Your Lambda function dynamically generates HTML content based on the request and the results of multiple downstream service calls. Some of these calls can take a long time to return a response. To optimize your users’ page loading experience, you use Lambda’s HTTP response streaming capabilities to improve Time to First Byte performance by rendering the first chunks of HTML in the browser as soon as your function generates them.
For simplicity, let’s assume your application processes three million requests per month. Let’s also assume you have exhausted the 100 GB of response streaming included in the AWS free tier. The average function duration is 500ms. You have configured your function with 1536 MB of memory on an x86 based processor. The average payload size per request is 100 KB for the first two million requests per month, and 7 MB for the last million requests per month. The example calculation assumes 1 GB = 1,024 MB.
Your charges would be calculated as follows:
Monthly compute charges
The monthly compute price is $0.0000166667 per GB-s and the free tier provides 400,000 GB-s.
Total compute (seconds) = 3 million * 500ms = 1,500,000 seconds
Total compute (GB-s) = 1,500,000 * 1536MB/1024 MB = 2,250,000 GB-s
Total compute – Free tier compute = monthly billable compute GB-s
2,250,000 GB-s – 400,000 free tier GB-s = 1,850,000 GB-s
Monthly compute charges = 1,850,000 * $0.0000166667 = $30.83Monthly request charges
The monthly request price is $0.20 per one million requests and the free tier provides 1 million request per month.
Total requests – Free tier requests = monthly billable requests
3 million requests – 1 million free tier requests = 2 million monthly billable requests
Monthly request charges = 2M * $0.2/M = $0.40Processed bytes charges
The monthly bytes streamed price is $0.008 per GB streamed and the free tier provides 100 GB per month. The first 6 MB streamed per request are also free.
Free bytes streamed (GB) = 2 million requests * 100 KB = 190.7 GB
Since 100 KB < 6 MB per request, the 190.7 GB streamed are free.
Chargeable bytes streamed (GB) = 1 million requests * (7 MB – 6 MB) = 976.56 GB
Monthly bytes streamed charges = 976.56 GB * $0.008 = $7.81Total monthly charges:
Total charges = Compute charges + Request charges + Bytes Streamed charges = $30.83 + $0.40 + $7.81 = $39.04 per month
Data Transfer & Other Charges
Data Transfer
Data transferred “in” to and “out” of your AWS Lambda functions, from outside the region the function executed, will be charged at the Amazon EC2 data transfer rates as listed under "Data transfer".
Data transfer with AWS Lambda Functions is free in the same AWS Region between the following services: Amazon Simple Storage Service (S3), Amazon Glacier, Amazon DynamoDB, Amazon Simple Email Service (SES), Amazon Simple Queue Service (SQS), Amazon Kinesis, Amazon Elastic Container Registry (ECR), Amazon Simple Notification Service (SNS), Amazon Elastic File System (EFS), and Amazon SimpleDB.
The usage of Amazon Virtual Private Cloud (VPC) or VPC peering, with AWS Lambda functions will incur additional charges as explained on the Amazon Elastic Compute Cloud (EC2) on-demand pricing page. A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses.
For details on AWS service pricing, see the pricing section of the relevant AWS service detail pages.
Lambda@Edge Pricing
Lambda@Edge functions are metered at a granularity of 1ms
-
Pricing Example:
If your Lambda@Edge function executed 10 million times in one month, and it ran for 10ms each time, your charges would be calculated as follows:If your Lambda@Edge function executed 10 million times in one month, and it ran for 10ms each time, your charges would be calculated as follows:Monthly compute charges
The monthly compute price is $0.00000625125 per 128MB-second
Total compute (seconds) = 10M * (0.01sec) = 100,000 seconds
Monthly compute charges = 100,000 * $0.00000625125 = $0.63
Monthly request chargesThe monthly request price is $0.60 per 1 million requests..
Monthly request charges = 10M * $0.6/M = $6.00
Total monthly charges
Total charges = Compute charges + Request charges = $0.63 + $6.00 = $6.63 per month
Additional pricing resources
Easily calculate your monthly costs with AWS
Contact AWS specialists to get a personalized quote