Skip to content

Instantly share code, notes, and snippets.

@rvaidya
Created November 22, 2016 03:12
Show Gist options
  • Save rvaidya/c758950dde5b97577fb8978d3e0dac5d to your computer and use it in GitHub Desktop.
Save rvaidya/c758950dde5b97577fb8978d3e0dac5d to your computer and use it in GitHub Desktop.
AWS Serverless pricing calculator
let jobsPerMinute = 60;
let lambdaMemory = 128;
let lambdaExecutionsPerJob = 3;
let averageJobRuntimeInMS = 1024;
let sqsMessageSizeInKB = 64;
let minutesPerMonth = 43800;
let hoursPerMonth = minutesPerMonth / 60;
let jobsPerHour = jobsPerMinute * 60;
let dynamoStrongReadsPerJob = 0;
let dynamoWeakReadsPerJob = 0;
let dynamoWritesPerJob = 1;
let neededDynamoReadCapacityUnits = (dynamoStrongReadsPerJob + dynamoWeakReadsPerJob / 2) * jobsPerHour / 180000 * 50;
let neededDynamoWriteCapacityUnits = dynamoWritesPerJob * jobsPerHour / 36000 * 10;
let dynamoPricePerMonth = 0.0065 * hoursPerMonth * (Math.max(neededDynamoReadCapacityUnits - 25, 0) + Math.max(neededDynamoWriteCapacityUnits - 25, 0));
let sqsPricePerMonth = 0.4 / 1000000 * Math.max(jobsPerMinute * minutesPerMonth - 1000000, 0);
sqsPricePerMonth += sqsMessageSizeInKB * 0.09
let lambdaRequestPricePerMonth = 0.2 / 1000000 * Math.max(jobsPerMinute * minutesPerMonth - 1000000, 0);
let lambdaRunPricePerMonth = 0.000000208 / lambdaMemory / 128 * averageJobRuntimeInMS / 100 * lambdaExecutionsPerJob * jobsPerMinute * minutesPerMonth;
let awsPricePerMonth = dynamoPricePerMonth + sqsPricePerMonth;
awsPricePerMonth += lambdaRequestPricePerMonth + lambdaRunPricePerMonth;
console.log(awsPricePerMonth);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment