marrakeshh - Fotolia
With cloud services evolving and proliferating, developers can now use services like AWS Lambda to call and execute...
computing functions as needed -- and only pay based on use. IT teams must understand the AWS billing model so there are no surprises when the bill arrives.
Amazon Web Services (AWS) Lambda turns on when a task must be performed and then turns off to save computing resources and costs. IT teams pay for each Lambda function based on the number of requests -- the number of times each function is called -- per month, plus the compute costs of each function request measured in gigabyte-seconds (GB-s). While this pricing model sounds straightforward on the surface, we run the numbers to help prepare for all associated costs.
AWS charges a baseline $0.20 per 1 million requests ($0.0000002 per function request), plus $0.00001667 for every GB-s. It seems like an extremely small amount of money to run an AWS Lambda function, but millions of requests and multiple functions per month add up. AWS also subtracts a free service tier of 1 million requests and 400,000 GB-s from monthly function costs.
To understand the AWS billing model for Lambda, determine the compute duration in GB-s. First, identify how much memory was allocated to the function upon creation. If a particular function uses 256 MB (0.25 GB) and was called 10 million times in a month -- each lasting one second -- that would be 10,000,000 seconds of execution time. So the compute demand for the function is 0.25 GB multiplied by 10,000,000 seconds, equaling 2,500,000 GB-s. Now subtract the 400,000 GB-s included with the free tier. This leaves us with 2,100,000 GB-s of billable duration at $0.00001667 per GB-s, or $35.01 in demand for the month.
Now let's calculate the price for the number of requests. There were 10 million requests, minus the 1 million requests included with the free tier. This leaves 9 million requests for the month at $0.20 per million requests, totaling $1.80 in request charges.
The total monthly cost for this Lambda function would be $36.81. This process repeats for each separate Lambda function if you use more than one over the course of a month.
Developers must be aware of all costs when planning or budgeting for Lambda functions. For example, there may be added costs if a Lambda function transfers data or uses other AWS products. Additional AWS billing may kick in for Simple Storage Service read/write requests and storage capacity usage. If a function exchanges data with Amazon DynamoDB, additional changes for storage and data transfers will apply. If data is moved to or from AWS, enterprises will be billed for data transfers at Amazon Elastic Compute Cloud pricing.
What is Lambda and how can it help your business?
Best practices for managing and monitoring Lambda code
AWS Lambda pushes PaaS to next level
IT pros can avoid management overhead on AWS Lambda
Dig Deeper on AWS Lambda
Related Q&A from Stephen J. Bigelow
Containers have rapidly come into focus as a popular option for deploying applications, but they have limitations and are fundamentally different ... Continue Reading
ALM and SDLC both cover much of the same ground, such as development, testing and deployment. Where these lifecycle concepts differ is the scope of ... Continue Reading
Eliciting performance requirements from business end users necessitates a clearly defined scope and the right set of questions. Expert Mary Gorman ... Continue Reading