Tips for forecasting AWS Serverless Cost

Debasis Rath
4 min readSep 12, 2023

--

Forecasting costs for serverless architecture like AWS Lambda can be a bit tricky given its pay-as-you-go nature, but it is definitely manageable. Here are the steps you can follow:

  1. Understand Your Current Usage: Go through your AWS billing and usage reports from the past year to understand how much you are currently using AWS Lambda and other related services.
  2. Identify Key Cost Drivers: Identify the key drivers of your costs. For AWS Lambda, this would be the number of requests, duration of your functions, and the amount of memory allocated to your functions. Provisioned Concurrency is also an important factor if you are using them for low-latency use cases.
  3. Estimate Future Usage: Estimate how your usage will change in the next year. Consider factors like new features or services you plan to launch, increase in user traffic, or any architectural changes you plan to make.
  4. Use AWS Cost Calculator: Use the AWS pricing calculator to estimate the costs based on your estimated usage. AWS also provides a ‘Simple Monthly Calculator’ that can help you estimate your monthly bill.
  5. Consider Data Transfer Costs: Don’t forget to account for data transfer costs. AWS charges for data transfer between regions and out of its network.
  6. Consider Provisioned Concurrency : If you have predictable workloads, you can save costs by using provisioned capacity in advance.
  7. Consider Additional AWS Services: Don’t forget about the costs of other AWS services that you use in conjunction with Lambda, such as API Gateway, S3, DynamoDB, etc.
  8. Factor In Developer Costs: The costs of developing, deploying, and maintaining your serverless applications should also be considered in your cost forecast.
  9. Estimate Cost Savings: Estimate any cost savings you may achieve by optimizing your serverless applications. AWS provides a number of tools and best practices that can help you optimize your costs.
  10. Build A Buffer: It is always good to build a buffer into your cost estimates to account for any unforeseen changes or spikes in usage.

Remember, forecasting is an iterative process and should be revisited regularly. AWS provides detailed billing and cost management tools that can help you monitor your costs and adjust your forecast as needed.

Tools You can use to Forecast AWS Lambda Cost

You can log into your AWS Organization Root and play with cost explorer for services like AWS Lambda to create a forecast. Forecasted charges are estimated based on your historical charges and may differ from your actual charges for the forecast period. Forecasted charges are provided solely for your convenience and do not take into account changes to your use of services after the date on which you view this page.

AWS Cost Explorer Forecasting AWS Lambda Cost Based On Current Usages

You can also use advanced Quicksight dashboards offered by AWS to look at the forecasted usages. You will see two distinct views of the forecast based on the type of Savings Plan you have for your compute (Applied to AWS lambda and fargate services) viz, Invoiced vs Amortized. Please refer to the CID dashboard here :

https://d1s0yx3p3y3rah.cloudfront.net/anonymous-embed?dashboard=cid

At this point if you want to build your own forecast model you can use AWS Forecast and AWS Cost and Usage report to build your own predictions. here is a small architecture and reference to a blog post for more data :

Use AWS Forecast to predict AWS Workload Cost

Serverless Cost goes beyond Just AWS Lambda [Step into FinOps ]

We all know AWS lamdba is just part of a serverless workload while, the workload can have many more other services in the mix. Tagging is a way to label your AWS resources with metadata that can make it easier to manage, search, and filter your resources. It is especially useful for cost management because you can allocate costs, track your AWS usage, and control your resources based on the tags you assign.

Here’s how you can use tagging and AWS Cost Explorer for forecasting:

  1. Implement a Tagging Strategy: Implement a comprehensive tagging strategy across all your AWS resources. AWS allows you to assign up to 50 tags per resource. Use meaningful key-value pairs like Project, Environment, Department, Owner, etc. For example, if you are running multiple applications, you might want to tag all resources related to a specific application with Application: AppName.
  2. Activate Your Tags: Once you’ve assigned tags to your resources, you’ll need to activate them in the AWS Cost Explorer. Go to the AWS Management Console, navigate to the Billing and Cost Management dashboard, and under the ‘Cost allocation tags’ section, activate the tags you want to use for cost allocation.
  3. Analyze Your Costs: AWS Cost Explorer will now start generating cost allocation reports based on your activated tags. You can view your AWS spending and usage based on your tags. For example, you can see how much each department, project, or application is costing you.
  4. Forecast Your Costs: AWS Cost Explorer also allows you to forecast your future costs based on your historical usage. You can create custom cost and usage forecasts based on your tags. For example, you can create a forecast for a specific application, department, or project. You can also refine your forecasts by other dimensions such as service, region, or usage type.
  5. Set Up Budgets and Alerts: Using the AWS Budgets service, you can set up budgets based on your tags and receive alerts when your spending or usage exceeds your budgeted amount. For example, you can set up a separate budget for each application, department, or project.

--

--

Debasis Rath
Debasis Rath

No responses yet