Understanding AWS Lambda Pricing and Lambda Cost Factors

aws lambda

Get a clear understanding of how AWS Lambda costs and AWS Serveless pricing for lambda are calculated and incurred.


AWS Lambda is a serverless compute service from AWS enabling developers to execute code seamlessly, eliminating the need for managing any underlying infrastructure. This article explores the nuances of AWS Lambda costs, including lambda function costs, how aws lambda pricing works, and optimization strategies based on memory. Delve into the specifics of AWS Lambda pricing, including costs per second, memory costs, and effective comparisons between Lambda and other AWS services like Fargate and EC2. Gain insights into AWS Lambda cost optimization and discover how much AWS Lambda and Amazon Lambda truly cost, ensuring informed decision-making for your development endeavors.

AWS Lambda is a powerful compute service where pay only for the compute time your Lambda functions consume, with no charges during idle periods. Whether it's running code for diverse applications or backend services, Lambda ensures seamless execution with zero administration. Simply upload your code, and Lambda handles the complexities of running and scaling it, ensuring high availability while optimizing costs

AWS Lambda Costs

Lambda execution counts a request each time it begins execution triggered by events like Amazon Simple Notification Service (SNS), Amazon EventBridge, or an invoke call from Amazon API Gateway. The execution count also include calls initiated via the AWS SDK, including test invocations from the AWS Console.

The duration is calculated from the moment your code starts executing until it completes, rounded up to the nearest 1 ms*. Pricing is influenced by the memory allocation for your function. In AWS Lambda's resource model, you determine the memory for your function, and it gets CPU power and resources proportionally. Increasing memory size leads to a corresponding boost in CPU power available to your function.

Your Lambda functions can operate on processors built on x86 or Arm architectures. AWS Lambda functions using Graviton2, an Arm-based processor architecture by AWS, offer up to 34% enhanced price performance compared to functions on x86 processors. This improvement is applicable across various serverless workloads, including web and mobile backends, data processing, and media processing.

Lambda Pricing AWS

With AWS Lambda pricing, it is important to understand two charges,

  • Compute Charge Compute charge is calculated based on the memory allocation, architecture type and ephemeral storage
  • Request Charge Request charge is calculated based on the total monthly invocations for the lambda

AWS Lambda pricing is decided by the following paramters,

  • Memory Allocation for the Lambda (Compute Charge)
  • Duration of the Lambda Execution (Request Charge)
  • Lambda architecture type (Compute Charge)
  • Lambda Ephemeral Storage (Compute Charge)

Lets understand the aws lambda pricing provided in the AWS website(https://aws.amazon.com/lambda/pricing/) AWS Lambda Cost Calculator

As per the above image, pricing is first split based on the architecture types - x86 and ARM. Next consideration is the memory allocation for the lambda and for each execution the pricing is claculated based on GB per second. Last column talks about the total requests charge for each Lambda execution.

For example, if there is a Lambda with 1GB memory allocation and 3 million request per month, this is how the compute charge will be based on the above aws lambda cost calculator,

  • Architecture Type: x86 (without considering the free tier) Total compute (seconds) = 3 million * 120ms = 360,000 seconds Total compute (GB-s) = 360,000 * 1024MB/1024 MB = 360,000 GB-s Monthly compute charges = 360,000 * $0.0000166667 = $6.00
  • Architecture Type: ARM (without considering the free tier) Total compute (seconds) = 3 million * 120ms = 360,000 seconds Total compute (GB-s) = 360,000 * 1024MB/1024 MB = 360,000 GB-s Monthly compute charges = 360,000 * $0.0000133334 = $4.80

Lets calculate the Request Charges now without considering the free tier,

Request charges are same for both the architecture in the above image and for this lambda irrespective of the arch type, it is going to cost as below,

The monthly request price is $0.20 per one million requests Total requests =3 million Monthly request charges = 3M * $0.2/M = $0.60

Total Cost for x86 based Lambda = $6.00 + $0.60 = $6.60 Total Cost for ARM based Lambda = $4.80 + $0.60 = $5.40 Please note we have'nt considered the AWS Lambda Free tier in our calculation.

AWS Lambda memory cost for x86AWS Lambda memory cost for ARM

Lambda Ephemeral Storage Pricing

The cost associated with ephemeral storage in AWS Lambda is contingent on the allocated storage amount and the duration of function execution, measured in milliseconds. Users have the flexibility to assign additional storage to their function, ranging from 512 MB to 10,240 MB in 1 MB increments. This configuration is applicable to functions running on both x86 and Arm architectures. Notably, the initial 512 MB of ephemeral storage is provided to each Lambda function without any extra charges, ensuring that users only incur costs for the supplementary storage they choose to configure. AWS Lambda memory cost for ARM

Understanding Provisioned Concurrency Pricing for AWS Lambda

by enabling Provisioned Concurrency for your AWS Lambda functions, the functions remain initialized and hyper-ready to respond within double-digit milliseconds. The pricing for Lambdas which enabled provisioned consurrency is based on the configured concurrency amount and the specified duration. While Provisioned Concurrency is active, you'll also be charged for Requests and Duration, following the pricing details discussed above. Should your function exceed the set concurrency, any additional execution is billed at the specified rate which is mentioned above.

AWS Lambda PC cost

Provisioned Concurrency is compatible with functions on both x86 and Arm architectures. The calculation is based on the duration from enabling to disabling, rounded up to the nearest five minutes. The pricing is influenced by the allocated memory and concurrency configuration, while duration costs are dependent on the memory allocation.

AWS Lambda Free Tier

The AWS Lambda free tier provides one million free requests monthly and 400,000 GB-seconds of compute time per month. This free tier is applicable even after the one year free subscription service which AWS offers. This allocation is applicable to functions utilizing both x86 and Graviton2 processors collectively. Moreover, the free tier encompasses 100GiB of HTTP response streaming per month, excluding the initial 6MB per request, which remains free.

AWS Lambda Free Tier Example

Let’s assume your application processes one million requests per month and the memory allocated for your lambda is 1GB. Then the cost associated with this Lambda execution is going to be zero as it falls in the free tier limit of AWS Lambda.

Now 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 1024 MB of memory, on an x86 based processor, (Pricing consideration are based on the AWS Lambda hosted in us-east-1 region)

  • Monthly compute charges Below is the cost calculation and how much time you get as part of free tier: Total compute (seconds) = 3 million * 120ms = 360,000 seconds Total compute (GB-s) = 360,000 * 1024MB/1024 MB = 360,000 GB-s Total compute – Free tier compute = monthly billable compute GB- s 360,000 GB-s – 400,000 free tier GB-s = -40,000 GB-s Monthly compute charges = 0 ( as the compute time is less than the free tier limit)
  • Monthly 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.40

  • Total monthly charges Total charges = Compute charges + Request charges = 0 + $0.40 = $0.40 per month

How Much Does AWS Lambda Cost with 1GB memory

Let’s assume there is an AWS Lambda based api supporting a web based applicaiton. Let's consider this lambda was invoked three million requests per month. The average function execution duration is 120 ms and the lambda function is configured with 1536 MB of memory, on an x86 based processor. Below is a summary of charges:

  • 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.33

  • Monthly 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.40

  • Total monthly charges Total charges = Compute charges + Request charges = $2.33 + $0.40 = $2.73 per month