LambdaTuner 1.0.3

dotnet tool install --global LambdaTuner --version 1.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local LambdaTuner --version 1.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=LambdaTuner&version=1.0.3
                    
nuke :add-package LambdaTuner --version 1.0.3
                    

Lambda Tuner CLI

NuGet .NET License: MIT AWS Lambda Platform

Lambda Tuner demo

A .NET CLI tool that automatically finds the optimal memory configuration for AWS Lambda functions by running real invocations across multiple memory sizes and recommending the sweet spot between cost and latency.

The Problem

AWS Lambda memory directly impacts CPU allocation, execution time, and cost. Most functions run on the default 128MB without any empirical validation, leading to:

  • Suboptimal latency on critical APIs
  • Poorly dimensioned costs
  • Decisions based on trial and error

Lambda Tuner solves this with a single command.

Installation

Requires .NET 9 SDK or later and AWS credentials configured.

dotnet tool install -g LambdaTuner

Usage

Basic scan

lambda-tuner scan --function my-function-name

Full options

lambda-tuner scan \
  --function my-function-name \
  --region us-east-1 \
  --invocations 10 \
  --payload-file ./payload.json \
  --alias staging \
  --output table

JSON output

lambda-tuner scan --function my-function-name --output json

Dry run (no real invocations)

lambda-tuner scan --function my-function-name --dry-run

Extend the memory range beyond 1024MB

# Test all standard breakpoints up to 3008MB (most AWS regions support up to 3008)
lambda-tuner scan --function my-function-name --max-memory 3008

# Test all breakpoints up to 10240MB (if your account/region supports it)
lambda-tuner scan --function my-function-name --max-memory 10240

Custom memory values (exact control)

lambda-tuner scan --function my-function-name --memory 128,512,1024,2048,3008

Example Output

  Lambda Tuner - Scan Results for my-function
  Region: us-east-1 | Original Memory: 128MB
  Executed at: 2026-03-21 14:32:00 UTC

  Memory     Avg Duration    P95 Duration    Est. Cost/mo    Efficiency   Status
  -----------------------------------------------------------------------
  128MB      450.2ms         512.0ms         $0.19           1.0000       OK
  256MB      320.5ms         380.1ms         $0.27           0.6421       OK
  384MB      275.0ms         305.0ms         $0.31           0.5189       OK     <-- recommended
  512MB      274.8ms         302.0ms         $0.41           0.5912       OK
  1024MB     273.0ms         299.0ms         $0.82           0.9100       OK

Options

Option Short Description Default
--function -f Lambda function name or ARN (required)
--region -r AWS region profile default
--invocations -n Invocations per memory configuration (1–50) 5
--payload-file -p Path to a JSON payload file none
--alias -a Lambda alias or version qualifier none
--dry-run Simulate without real invocations false
--output -o Output format: table or json table
--memory -m Comma-separated memory values in MB (e.g. 128,512,1024,3008) none
--max-memory Upper bound in MB — tests all standard breakpoints up to this value. Ignored when --memory is set. none

Default memory values tested

128, 256, 384, 512, 768, 1024 MB

This safe default works in every AWS region and account. To test beyond 1024MB use --max-memory or --memory:

# Standard breakpoints up to 3008MB (us-east-1 / most regions)
--max-memory 3008
# → tests: 128, 256, 384, 512, 768, 1024, 1536, 2048, 3008

# Full range (regions & accounts that support >3008MB)
--max-memory 10240
# → tests: 128, 256, 384, 512, 768, 1024, 1536, 2048, 3008, 4096, 6144, 8192, 10240

AWS Permissions Required

The IAM identity running the tool must have the following permissions on the target function:

{
  "Effect": "Allow",
  "Action": [
    "lambda:GetFunctionConfiguration",
    "lambda:UpdateFunctionConfiguration",
    "lambda:InvokeFunction"
  ],
  "Resource": "arn:aws:lambda:*:*:function:your-function-name"
}

How It Works

  1. Retrieves the current function configuration
  2. For each memory value to test:
    • Updates the function memory
    • Waits for the update to become active
    • Runs one warm-up invocation (discarded)
    • Runs N parallel invocations (up to 5 concurrent) and measures real duration from CloudWatch log tails
    • Calculates average, P95, and estimated monthly cost
  3. Computes an efficiency score that balances duration and cost
  4. Recommends the configuration with the best efficiency score
  5. Restores the original configuration unconditionally — even if the scan is cancelled

Important Warnings

Direct production impact: Without --alias, the tool modifies live function configuration during the scan. The tool will prompt for confirmation before proceeding.

Additional costs: Each scan invokes the function multiple times per memory configuration. For expensive functions, use --invocations 1 and --memory to limit scope.

Timeout: Updating function configuration takes a few seconds per memory value. A full scan across all 13 default memory values typically takes 2–5 minutes.

Use a staging alias to avoid any production impact:

lambda-tuner scan \
  --function my-function \
  --alias staging \
  --payload-file ./test-event.json \
  --invocations 10

Roadmap

  • Support for multiple functions in a single scan
  • CI/CD integration (exit code based on regression threshold)
  • Export scan results to S3
  • Markdown and HTML report output
  • Advanced recommendation strategies (latency-optimized, cost-optimized)
  • Support for Lambda container images

Contributing

Contributions are welcome. Open an issue to discuss what you'd like to change before submitting a pull request.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.3 97 3/21/2026
1.0.2 65 3/21/2026
1.0.1 65 3/21/2026
1.0.0 71 3/21/2026

1.0.1 — Fix decimal formatting for non-English locales (InvariantCulture), suppress info logs from CLI output, show N/A for dry-run rows, update ASCII banner.