Aws Lambda Pricing Calculator

AWS Lambda Pricing Calculator

Estimate your monthly AWS Lambda costs based on your expected usage.

Total number of times your function is invoked per month.
Average execution time per invocation in milliseconds.
Memory allocated to your function in megabytes (128 MB to 10240 MB).

Understanding AWS Lambda Pricing

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. You only pay for the compute time you consume. There is no charge when your code is not running.

Key Pricing Dimensions:

  • Requests: You are charged for the number of times your function is invoked.
  • Duration: You are charged for the time your code executes, rounded up to the nearest millisecond. The duration is dependent on the memory allocated to your function. It's measured in "GB-seconds".
  • Memory: The amount of memory you allocate to your function directly impacts its cost and performance. More memory means higher cost per unit of time, but can also lead to faster execution.

AWS Lambda Free Tier:

AWS Lambda offers a generous free tier that includes:

  • 1 million free requests per month.
  • 400,000 GB-seconds of compute time per month.

This free tier is sufficient for many small applications and development workloads.

How the Calculator Works:

This calculator estimates your monthly AWS Lambda costs based on the following assumptions (using x86_64 architecture pricing):

  • Requests: After the first 1 million free requests, you are charged $0.20 per 1 million requests.
  • Compute (Duration & Memory): After the first 400,000 GB-seconds free tier, you are charged $0.0000166667 per GB-second.

A GB-second is calculated as: (Average Duration in seconds) * (Memory Allocated in GB).

Example Usage:

Let's say you have a Lambda function that is invoked 2 million times a month, runs for an average of 200 milliseconds, and has 256 MB of memory allocated.

  1. Monthly Invocations: 2,000,000
  2. Average Duration (ms): 200
  3. Memory Allocated (MB): 256

Using the calculator:

  • Billable Requests: 2,000,000 – 1,000,000 (free tier) = 1,000,000 requests.
  • Request Cost: (1,000,000 / 1,000,000) * $0.20 = $0.20
  • Total GB-seconds: (2,000,000 invocations * 200 ms/invocation) / 1000 ms/s * (256 MB / 1024 MB/GB) = 400,000 seconds * 0.25 GB = 100,000 GB-seconds.
  • Billable GB-seconds: 100,000 GB-seconds – 400,000 (free tier) = 0 GB-seconds (since it's less than the free tier).
  • Compute Cost: 0 * $0.0000166667 = $0.00
  • Estimated Monthly Cost: $0.20 + $0.00 = $0.20

This example shows how the free tier can significantly reduce costs for many use cases.

Important Considerations:

  • This calculator provides an estimate for standard Lambda execution. It does not include costs for data transfer, provisioned concurrency, ephemeral storage (up to 10 GB is free), or other integrated AWS services (like S3, DynamoDB, API Gateway, etc.) that your Lambda function might interact with.
  • AWS offers different pricing for Arm-based (Graviton2) functions, which are typically 20% cheaper. This calculator uses x86_64 pricing.
  • Pricing can vary by AWS region. This calculator uses general US region pricing.
  • Always refer to the official AWS Lambda Pricing page for the most up-to-date and detailed information.
.calculator-container { background-color: #f9f9f9; border: 1px solid #ddd; padding: 20px; border-radius: 8px; max-width: 600px; margin: 20px auto; font-family: Arial, sans-serif; } .calculator-container h2 { color: #232F3E; text-align: center; margin-bottom: 20px; } .calc-input-group { margin-bottom: 15px; } .calc-input-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #333; } .calc-input-group input[type="number"] { width: calc(100% – 22px); padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } .calc-input-group small { display: block; margin-top: 5px; color: #666; font-size: 0.9em; } button { background-color: #FF9900; color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; width: 100%; box-sizing: border-box; transition: background-color 0.3s ease; } button:hover { background-color: #E68A00; } .calc-result { margin-top: 20px; padding: 15px; background-color: #e6f7ff; border: 1px solid #99e6ff; border-radius: 4px; font-size: 1.1em; color: #0056b3; } .calc-result p { margin: 5px 0; } .calc-result strong { color: #232F3E; } .calculator-article { max-width: 600px; margin: 40px auto; font-family: Arial, sans-serif; line-height: 1.6; color: #333; } .calculator-article h3, .calculator-article h4 { color: #232F3E; margin-top: 25px; margin-bottom: 15px; } .calculator-article ul { list-style-type: disc; margin-left: 20px; margin-bottom: 15px; } .calculator-article ol { list-style-type: decimal; margin-left: 20px; margin-bottom: 15px; } .calculator-article li { margin-bottom: 5px; } .calculator-article a { color: #0073bb; text-decoration: none; } .calculator-article a:hover { text-decoration: underline; } function calculateLambdaCost() { // Get input values var monthlyRequests = parseFloat(document.getElementById("monthlyRequests").value); var averageDurationMs = parseFloat(document.getElementById("averageDurationMs").value); var memoryAllocatedMb = parseFloat(document.getElementById("memoryAllocatedMb").value); var resultDiv = document.getElementById("lambdaResult"); resultDiv.innerHTML = ""; // Clear previous results // Validate inputs if (isNaN(monthlyRequests) || monthlyRequests < 0) { resultDiv.innerHTML = "Please enter a valid number for Monthly Invocations (0 or greater)."; return; } if (isNaN(averageDurationMs) || averageDurationMs <= 0) { resultDiv.innerHTML = "Please enter a valid positive number for Average Duration (milliseconds)."; return; } if (isNaN(memoryAllocatedMb) || memoryAllocatedMb 10240) { resultDiv.innerHTML = "Please enter a valid Memory Allocated (128 MB – 10240 MB)."; return; } // AWS Lambda Pricing Constants (x86_64, general US region, as of early 2023) var FREE_REQUESTS = 1000000; // 1 million free requests per month var REQUEST_COST_PER_MILLION = 0.20; // $0.20 per 1 million requests after free tier var FREE_GB_SECONDS = 400000; // 400,000 GB-seconds free per month var COMPUTE_COST_PER_GB_SECOND = 0.0000166667; // $0.0000166667 per GB-second // Step 1: Calculate total GB-seconds var totalDurationSeconds = (monthlyRequests * averageDurationMs) / 1000; // Total duration in seconds var memoryAllocatedGb = memoryAllocatedMb / 1024; // Memory in GB var totalGbSeconds = totalDurationSeconds * memoryAllocatedGb; // Step 2: Apply Free Tier for Requests var billableRequests = Math.max(0, monthlyRequests – FREE_REQUESTS); var requestCost = (billableRequests / 1000000) * REQUEST_COST_PER_MILLION; // Step 3: Apply Free Tier for Compute (GB-seconds) var billableGbSeconds = Math.max(0, totalGbSeconds – FREE_GB_SECONDS); var computeCost = billableGbSeconds * COMPUTE_COST_PER_GB_SECOND; // Step 4: Total Estimated Cost var totalCost = requestCost + computeCost; // Display results resultDiv.innerHTML = "Estimated Monthly Cost: $" + totalCost.toFixed(2) + "" + "Monthly Invocations: " + monthlyRequests.toLocaleString() + "" + "Average Duration: " + averageDurationMs.toLocaleString() + " ms" + "Memory Allocated: " + memoryAllocatedMb.toLocaleString() + " MB" + "
" + "Billable Requests (after free tier): " + billableRequests.toLocaleString() + "" + "Request Cost: $" + requestCost.toFixed(2) + "" + "Total GB-Seconds: " + totalGbSeconds.toLocaleString(undefined, { maximumFractionDigits: 2 }) + "" + "Billable GB-Seconds (after free tier): " + billableGbSeconds.toLocaleString(undefined, { maximumFractionDigits: 2 }) + "" + "Compute Cost: $" + computeCost.toFixed(2) + ""; } // Run calculation on page load with default values window.onload = calculateLambdaCost;

Leave a Reply

Your email address will not be published. Required fields are marked *