Cloud cost optimization with Lambda Power Tuning
AWS Lambda Power Tuning is a serverless computing tool that helps you optimize the balance between cost and performance for your specific workloads, without the need to provision or manage servers. Those workloads can come from various AWS services like S3, API Gateway, DynamoDB, or custom applications.
This article can help you
drive cost reductions and achieve optimal performance for your Lambda use case. Following the strategies outlined, you can make informed decisions about memory allocation and execution time, ensuring your applications run efficiently without overspending.
How Lambda Power Tuning impacts on Lambda costs

Lambda charges based on the amount of memory allocated and the milliseconds of execution time. The range of memory you can configure for a Lambda function is between 128 MB and 10,240 MB.
As your Lambda function processes larger amounts of data, you will need to allocate more memory. The amount of memory also determines the allocation of the virtual CPU to the Lambda function. This means that increasing the memory not only enhances the available CPU but also improves the overall performance.
The table below shows the pricing per 1 million requests in North Virginia (us-east-1):
Memory (MB) | Cost per millisecond request | Cost per 1M requests |
---|---|---|
128 | $0.0000000021 | $0.0021 |
512 | $0.0000000083 | $0.0083 |
1.024 | $0.0000000167 | $0.0167 |
1536 | $0.0000000250 | $0.0250 |
2048 | $0.0000000333 | $0.0333 |
3072 | $0.0000000500 | $0.0500 |
4096 | $0.0000000667 | $0.0667 |
5120 | $0.0000000833 | $0.0833 |
6144 | $0.0000001000 | $0.1000 |
7168 | $0.0000001167 | $0.1167 |
8192 | $0.0000001333 | $0.1333 |
9216 | $0.0000001500 | $0.1500 |
10.24 | $0.0000001667 | $0.1667 |
Selecting the optimal memory configuration can be challenging. While increasing memory typically raises costs, it also tends to reduce processing time. In the following sections, you’ll learn how Lambda Power Tuning can assist in this analysis.
What is Lambda Power Tuning?
According to the AWS official documentation, “AWS Lambda Power Tuning is a state machine powered by AWS Step Functions that helps you optimize your Lambda functions for cost and/or performance in a data-driven way.” In summary, Lambda Power Tuning is a tool that helps you identify and visualize the optimal memory size for your specific Lambda function.
This solution utilizes
AWS Step Functions, a service that allows you to orchestrate complex, scalable, and resilient workflows.
The image below illustrates how the Step Functions work within the solution:

To use the tool, you must provide the ARN (Amazon Resource Name) of your Lambda function along with a range of memory configurations, from 128 MB to 10 GB. Once the execution is complete, you’ll receive analytics and a recommendation for the best memory configuration.
How to use Lambda Power Tuning to improve your cost optimization
In this section, we’ll walk you through how to use the Lambda Power Tuning tool step by step. You’ll learn how to analyze your Lambda function and get a tailored recommendation for the optimal memory configuration.
First, make sure you have already logged in to AWS console, then follow the steps below:
1 - Access this link.
2 - Keep all parameters as default and simply check the box “I acknowledge that this app creates custom IAM roles.”

3 - Then click on the “Deploy” button
4 - Access the Step Function console in this link.
5 - Click on the State Machine that has the prefix “powerTuningStateMachine-” in the name.

6 - Click on the “Start execution” button

7 - Copy and paste the JSON below in “Input - optional” and then click on “Start Execution”.
{
"lambdaARN": "your-lambda-function-arn",
"powerValues": [128, 256, 512, 1024, 2048, 3008],
"num": 10,
"payload": "{}",
"parallelInvocation": true,
"strategy": "cost"
}
OBS: In "your-lambda-function-arn" replace with the ARN of your Lambda function. If your function has a payload, place the value in "{}" in the "payload" key line.
The execution should be starting. Please wait until the entire process is complete, this can take a few minutes. Once the process finishes, expand the last event in the “Events” table and copy the link indicated, like the image below:

Paste the link into a new tab to view the results as shown below:

The result shows four configuration results. The configuration with the Best Cost, Best Time, Worst Cost, and with the Worst Time. In this example, the most cost-effective memory configuration was 1024 MB. The table below shows the results from the graph:
Memory Size | Time | Invocation cost |
---|---|---|
128 MB | 51992 ms | $0.000109 |
256 MB | 26145 ms | $0.000110 |
512 MB | 12979 ms | $0.000109 |
1024 MB | 6377 ms | $0.000107 |
2048 MB | 3633 ms | $0.000122 |
3008 MB | 3502 ms | $0.000173 |
Note that both memory configurations (128 MB and 512 MB) have the same cost, but the 512 MB solution is four times faster.
In parallel, increasing memory from 2048 MB to 3008 MB resulted in only a 3.6% reduction in time while the cost increased 41%.
To choose the best memory configuration, consider the following questions:
- Do you need maximum speed regardless of cost?
- Do you need the most cost-effective memory configuration?
If you answered “yes” to the first question, you can use a large memory size to achieve the best performance for your application. Suppose you answered “yes” to the second question as well. In that case, you should calculate the cost of different memory sizes and the time it takes to complete each task to determine the most cost-effective memory configuration.
When considering optimizing your AWS Lambda functions, keep in mind that you’ll need to choose a cost-effective memory allocation and execution time, which is in line with the AWS Cost Optimization pillar. The Lambda Power Tuning tool proves to be a powerful tool for this optimization process, allowing detailed and effective cost and performance analysis.
This tool permits you to analyze different memory configurations to find the optimal balance that meets your performance requirements while minimizing costs. Additionally, integrating this approach with a
FinOps strategy ensures that your cloud costs are managed efficiently, promoting financial accountability within your organization.
References
- https://docs.aws.amazon.com/lambda/latest/operatorguide/computing-power.html
- https://docs.aws.amazon.com/lambda/latest/operatorguide/profile-functions.html
- https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:451282441545:applications~aws-lambda-power-tuning
- https://github.com/alexcasalboni/aws-lambda-power-tuning?tab=readme-ov-file
- https://aws.amazon.com/pt/step-functions/
- https://docs.aws.amazon.com/wellarchitected/latest/framework/cost-optimization.html
e-Core
We combine global expertise with emerging technologies to help companies like yours create innovative digital products, modernize technology platforms, and improve efficiency in digital operations.