AWS Lambda Pricing : How to Keep Your Costs Low?

Description of the image

AWS Lambda, a serverless computing indulgence handed over by Amazon Web Services, allows developers to run code without provisioning or managing servers. Lambda executes code in reaction to triggers analogous to changes in data, system country, or user conduct, automatically managing the compute resources demanded by that code. 

One of the pivotal advantages of utilizing AWS Lambda is its pricing model, which offers a cost-operative expressway to make and emplace operations.

Elements of AWS Lambda Pricing

AWS Lambda pricing is based on three primary factors: request pricing, duration pricing, and fresh costs for voluntary features such as provisioned concurrency and data transfer. Let's explore each element in detail. 

AWS Lambda Pricing

Request Pricing

AWS Lambda charges for the number of requests your functions admit. Each time you create a function, it counts as a request. AWS Lambda includes a free bracket of 1 million requests per month. Beyond the free bracket, the cost is$0.20 per 1 million requests. 

Suppose you have a Lambda function configured with 512 MB of mind that executes 10 million moments monthly, with a moderate execution time of 200 milliseconds (0.2 seconds). 


Total requests=10,000,000

Free tier=1,000,000

Billable requests=10,000,000−1,000,000=9,000,000

Request cost=9,000,000×$0.20/1,000,000=$1.80


Duration Pricing

Duration is calculated from when your code begins executing until it returns or terminates, rounded to the nearest one millisecond. The duration price depends on the quantum of memory allocated to the function. AWS Lambda offers several memory configurations ranging from 128 MB to 10,240 MB. The formula for calculating duration pricing is 


Duration cost =  Memory( GB) × Execution time( seconds) × Rate  The rate for 1 GB- second is $0.0000166667

For example                        

 Memory configuration=512 MB=0.5 GB

Execution time per request=0.2 seconds

Total duration=10,000,000×0.2 seconds=2,000,000 seconds=555.56 hours

Billable duration (GB-seconds)=0.5×2,000,000=1,000,000 GB-seconds

Duration cost=1,000,000×$0.0000166667=$16.67

Provisioned Concurrency Pricing

Provisioned Concurrency is a voluntary point that keeps your functions initialized and ready to respond in double-figure milliseconds. This point can be helpful for operations that require predictable latency. The cost for Provisioned Concurrency includes an hourly rate and a duration rate.   

Provisioned Concurrency$0.0000041667 per GB-alternate  

Provisioned Concurrency execution duration$0.0000133334 per GB-alternate 

Additional Costs

Further charges may apply based on your use case and configuration,  similar to data transfer charges and charges for utilizing other AWS services (e.g., API Gateway, S3, DynamoDB). 

AWS Lambda Pricing

Pricing Component

Free Tier

Paid Tier



1 million requests per month

Beyond Free Tier

$0.20 per 1 million requests




$0.0000166667 per GB-second

Provisioned Concurrency



$0.0000041667 per GB-second

Provisioned Concurrency Duration



$0.0000133334 per GB-second

Data Transfer


Charged as per AWS Data Rates

Varies by region and amount of data


AWS Lambda Pricing Based on Region

RegionRequests (per million)Duration (per GB-second)Free Tier (per month)
US East (N. Virginia)$0.20$0.000016671 million requests, 400,000 GB seconds
US West (Oregon)$0.20$0.000016671 million requests, 400,000 GB seconds
EU (Ireland)$0.20$0.000016671 million requests, 400,000 GB seconds
Asia Pacific (Sydney)$0.23$0.000019671 million requests, 400,000 GB seconds
Asia Pacific (Tokyo)$0.23$0.000019671 million requests, 400,000 GB seconds
South America (São Paulo)$0.24$0.000021001 million requests, 400,000 GB seconds

How to calculate AWS Lambda price?

Factors Affecting AWS Lambda Pricing

Several factors can influence the total cost of using AWS Lambda, including:

Function Memory Allocation

The quantity of memory you allow to your Lambda function directly affects the cost. Further memory results in advanced charges but can also improve interpretation and reduce execution time. 

Execution Time

The duration for which your Lambda function runs impacts the typical cost. Optimizing your code to run more efficiently can support reduced implementation time and charges. 

Number of Requests

The more constantly your function is invoked, the more advanced the request charges will be. Monitoring and managing incantation frequency is essential for cost control. 

Provisioned Concurrency

However, utilizing provisioned concurrence can ensure that your functions are invariably ready to apply, but this comes at a fresh cost if you require predictable interpretation. 

Data Transfer

Nevertheless, data transfer charges may apply If your Lambda function interacts with other AWS services or alien endpoints. Understanding these charges is pivotal for budgeting. 

Cost Comparison of AWS Lambda with Azure Functions and Google Cloud

FeatureAWS LambdaTraditional Server-BasedAzure FunctionsGoogle Cloud Functions
Pricing ModelPay-per-use (requests and compute time)Fixed costs (server hardware, maintenance)Pay-per-use (executions and runtime)Pay-per-use (invocations and execution time)
Compute Time Cost$0.00001667 per GB-secondVaries (cost of physical/virtual servers)$0.000016 per GB-second$0.0000025 per GB-second
Request Cost$0.20 per 1M requestsN/A$0.20 per 1M executions$0.40 per 1M invocations
ScalabilityAutomaticManual scaling neededAutomaticAutomatic
MaintenanceNone (managed by AWS)Full responsibility (hardware/software updates)None (managed by Azure)None (managed by Google)
Cold Start LatencyYes (milliseconds to seconds)N/AYes (milliseconds to seconds)Yes (milliseconds to seconds)
IntegrationSeamless with AWS ecosystemRequires custom integrationSeamless with Azure servicesSeamless with Google Cloud services
Popular Use CasesMicroservices, real-time data processingAny long-running applicationEvent-driven tasks, HTTP triggersEvent-driven tasks, HTTP triggers
Free Tier1M requests and 400,000 GB seconds per monthN/A1M executions and 400,000 GB seconds per month2M invocations and 400,000 GB seconds per month

AWS Lambda Cost Optimization by Execution Time

AWS Lambda Cost Optimization

Cost Optimization Techniques

If you want to optimize the cost of AWS Lambda, you must consider the following strategies:

Right-Sizing Memory Allocation

Start with the lowest memory allocation that meets your performance needs and adjust as necessary. AWS Lambda provides detailed criteria to help you understand the optimal mind configuration. 

Optimize Code Efficiency

Effective code can reduce implementation time, which in turn lowers duration charges. Profiling and optimizing your code can result in significant cost savings. 

Use Free Tier

Take advantage of the AWS Lambda free category, which provides 1 million free queries and 400,000 GB-seconds of computing time per month. This can significantly reduce charges for low—to moderate-operations. 

Implement Request Batching

Nonetheless, account batching queries reduce the number of function invocations if your operation permits some latency. 

Monitor and Analyze Usage

Regularly reconsider your Lambda operation and charges using AWS Cost Explorer and AWS CloudWatch. Correlating operation patterns and exceptions can help optimize resource allocation and reduce charges. 

Consider Reserved Concurrency

However, reserved concurrence can save costs compared to on-demand provisioned concurrence if you have predictable operation patterns. 

AWS EC2 Pricing Vs AWS Lambda Pricing?

ServicePricing ModelExample Cost (per month)Use Case
AWS LambdaPay-per-use$0.20 per 1M requests + $0.00001667 per GB-secondCost-effective for intermittent, short-duration tasks.
AWS EC2On-Demandt2.micro: $8.34, m5.large: $70.08Suitable for sustained, long-running processes or specific hardware needs.

Key Points:

  • AWS Lambda: Ideal for functions that are invoked intermittently and do not run continuously.
  • AWS EC2: Best for applications requiring consistent availability.

What makes Lambda so expensive?

High Request VolumeAWS Lambda costs increase with the number of requests.
Execution TimeIt is billed based on the duration of code execution in 100ms increments.
Memory AllocationCharged based on the amount of memory allocated to functions, higher memory settings increase costs.
Data TransferData transferred out of Lambda functions is billed, especially for data-intensive operations.
Additional ServicesUsing additional AWS services (e.g., S3, DynamoDB) in conjunction with Lambda functions can contribute to overall higher costs.
Idle Time CostsLambda bills for idle time between function invocations if the function is kept warm.
Development ComplexityComplexity in managing and optimizing serverless architectures can lead to inefficiencies, indirectly increasing operational costs.
Monitoring and LoggingCosts associated with CloudWatch logging and monitoring can add up, especially with detailed logs for debugging purposes.

Commands for AWS Lambda

aws lambda create-function
Creates a new Lambda function.
aws lambda delete-function
Deletes an existing Lambda function.
aws lambda update-function-code
Updates the code for an existing Lambda function.
aws lambda update-function-configuration
Updates the configuration settings for an existing Lambda function.
aws lambda list-functions
Lists all Lambda functions in the AWS account.
aws lambda get-function
Retrieves configuration details for a specific Lambda function.
aws lambda invoke
Invokes a Lambda function synchronously.
aws lambda invoke-async
Invokes a Lambda function asynchronously.
aws lambda list-aliases
Lists all aliases for a specific Lambda function.
aws lambda create-alias
Creates a new alias for a specific Lambda function.
aws lambda update-alias
Updates an existing alias for a specific Lambda function.
aws lambda delete-alias
Deletes an alias for a specific Lambda function.
aws lambda list-event-source-mappings
Lists all event source mappings for a specific Lambda function.
aws lambda create-event-source-mapping
Creates a new event source mapping for a specific Lambda function.
aws lambda update-event-source-mapping
Updates an existing event source mapping for a specific Lambda function.
aws lambda delete-event-source-mapping
Deletes an event source mapping for a specific Lambda function.
aws lambda list-tags
Lists all tags associated with a specific Lambda function.
aws lambda tag-resource
Adds tags to a specific Lambda function.
aws lambda untag-resource
Removes tags from a specific Lambda function.
aws lambda publish-version
Publishes a new version of a specific Lambda function.
aws lambda list-versions-by-function
Lists all versions of a specific Lambda function.
aws lambda list-layer-versions
Lists all versions of a specific Lambda layer.
aws lambda publish-layer-version
Publishes a new version of a specific Lambda layer.
aws lambda add-layer-version-permission
Grants permission to another AWS account to use a specific version of a Lambda layer.
aws lambda remove-layer-version-permission
Revokes permission from another AWS account to use a specific version of a Lambda layer.
aws lambda get-layer-version
Retrieves information about a specific version of a Lambda layer.
aws lambda delete-layer-version
Deletes a specific version of a Lambda layer.

Summing Up AWS Lambda Pricing

AWS Lambda offers an adjustable and cost-operative serverless computing option with a pricing model that scales with the operation. This model includes several crucial factors: requests, duration, provisioned concurrence, and fresh charges similar to data transfer. Requisition pricing charges for the number of function invocations, while duration pricing is based on the mind distribution and the execution time of each invocation. Provisioned concurrence, a voluntary point, ensures places are invariably ready to respond snappily but comes with its charges. 

To further control charges, employing strategies like right-sizing memory allocation and optimizing code effectiveness is essential. Starting with the lowest necessary memory allocation and conforming based on interpretation metrics can reduce gratuitous charges. Also, authoring effective code can drop execution time and lower duration charges. Using AWS Lambda’s free tier, which provides a physical quantum of free operation each month, can also contribute to significant savings for low to moderate workloads.

Read More

Follow us on

Table of Contents

    Subscribe to Us

    Always Get Notified