Dragonfly Cloud announces new enterprise security features - learn more

Question: Does AWS Lambda cost money?

Answer

AWS Lambda is a serverless computing service that allows you to run code without provisioning or managing servers. While AWS Lambda can offer cost savings, it is not necessarily free and costs may vary based on several factors.

Pricing Overview

AWS Lambda pricing is primarily based on two key dimensions: requests and duration.

  1. Requests: AWS Lambda charges you based on the number of requests your functions receive. Every time a function is invoked, it counts as a request. As of the latest pricing, AWS offers a free tier of 1 million requests per month; after which you will be charged per million requests.

  2. Duration: Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 1 millisecond. The pricing also depends on the amount of memory you allocate to your function. The higher the memory allocation, the higher the cost. AWS provides 400,000 GB-seconds of compute time per month as part of the free tier. After this, you will be billed based on the amount of memory and the execution duration of your functions.

Additional Considerations

  • Provisional Capacity and Compute Power: If you choose to reserve compute power with AWS Lambda Provisioned Concurrency, you'll be charged for the amount of concurrency you configure and the duration it is provisioned.

  • Networking Costs: If your Lambda function interacts with other AWS services or external systems, you may incur additional costs based on the data transfer in and out of AWS.

  • Other Services: Lambda functions often work with other AWS services (e.g., S3, DynamoDB), which may increase the total cost depending on usage.

Example Cost Calculation

Here's a simple example to illustrate potential costs:

  • Suppose your function is invoked 2 million times in a given month.
  • Allocated memory is 256 MB, and it runs for an average duration of 1 second.
- Requests cost: (2 million - 1 million free) * rate per million requests
- Duration cost: (Execution duration in seconds) * (Allocated memory in GB) * (Rate per GB-second)
  = (2 million seconds * 0.256 GB) * (Rate per GB-second)

AWS provides a calculator to help estimate costs based on your expected usage patterns.

Conclusion

AWS Lambda can be cost-efficient if managed appropriately, especially with the free tier for minimal workloads. However, if your usage grows significantly beyond the free tier, or if your functions require extensive memory and duration, it could potentially lead to higher costs. Proper monitoring and usage estimation are crucial in optimizing and forecasting your Lambda expenses.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost