Is serverless cheaper for your use case? Find out with this calculator.
By: Xavier Lefèvre
Tags: Finops, Serverless, Infrastructure, AWS, Lambda

At the end of the month, when you receive your serverless bill, you mainly see one number. If you want to compare this number with non-serverless app costs, you shouldn’t simply compare it to infrastructure costs, you should broaden your comparison and also include:

a chunk of Ops salaries

SaaS bills such as a monitoring tool

development efforts for generic features like authentication, or efforts related to technology maturity and skills build-up

This high-level perspective is key when assessing the economic value of serverless, as serverless encompasses TCO’s 3 variables in one bill.

To give two concrete examples:

A service such as Lambda is managed, monitored and auto-scalable by design, which means reducing the operational burden to handle classic performance issues and system maintenance.

Another service like Cognito is pre-packaging an always up-to-date industry-standard way of handling authentication, users and authorisation, seamlessly auto-wired to other AWS services, which means you won’t have to spend developer days on rebuilding or rewiring something similar in your architecture.

Yan Cui wrote a good case explaining how serverless indeed lowers costs when looking through the TCO lens. Deloitte published a white paper on the topic in which they compare serverless vs more traditional approaches on each TCO component using real examples.

Serverless costs control: With the right set of skills, the technology enables feature-level cost optimisation

There are many examples showing how cloud costs can get out of control (like this fresh one). With AWS, you cannot define cost ceilings. You can only create cost alarms. Which is not as reassuring as it should be: Denial-of-Wallet, I see you.

The possibility of being hit by an over-spending is real. Just like the possibility of slow, or worse, crashed, systems in a classical architecture because of un-planned traffic. This is a direct consequence of the big shift in paradigm that serverless is. It is also an amazing opportunity: cloud providers are giving us the power to scale instantly, which reduces the effort of hiring and managing a dedicated team.

To counter this over-spending fear, some Ops and Architect tasks are moving towards FinOps. As a FinOps you optimise your system “slightly” less for performance and maintenance reasons, and a lot more for financial ones. A nice illustration of this is Alex Casalboni’s analysis on optimising Lambda execution time and cost by defining the right resource allocation.

Serverless gives you the tools for a complete and granular cost control over each feature and each piece of your architecture. You can see where you spend more than you should. You can assess the very ROI of a feature to better understand its impact on the business. Which is what a company always ends up looking at. Cloud providers are “merely” abstracting generic complexity away, and creating a shortcut toward more financial control.

Some fixed architectural opinions help estimate a serverless project cost

To help people estimate the cost of a serverless project and to share best FinOps practices, we decided to build an AWS serverless cost calculator. This calculator is meant to be easy to use while including each component of a complete architecture.

Why is it different from what you can already find online? Because it relies on an opinion of what a serverless architecture should look like. That’s where we used our FinOps skills, arbitrating what services and how to use them to simplify the process of estimating an AWS serverless app cost.

I agree that all architectures are different, and costs can change many-fold because of some differences. But at the same time most web applications share a lot of common elements: authentication, a database with some models, an API to get and update those models, a few files on a system, some asynchronous tasks and a couple of advanced workflows (think e-commerce checkout funnel or multi-step identity validation).

When standardising what a typical serverless architecture can be, it makes easier the task of estimating costs for typical use cases. It also creates a place for thorough discussions and welcome challenges within the community to aim for consensus toward always more optimised systems.

These opinionated principles can be found in my previous article: What a typical 100% Serverless Architecture looks like in AWS! I invite you to read it to fully understand the calculator.

With the calculator, you have two ways to estimate: either be guided by pre-defined scenarios, or define one with your own inputs