Is serverless cheaper for your use case? Find out with this calculator.
When talking about serverless, cost savings and auto-scaling are the first benefits that come to mind. Companies expect reduced operations time and lower costs to deliver more value on features critical to their business.
A dream (at least for investors).
I guess you’ve read this theory a few times already. And still, how can you be sure that serverless is the right fit for you? That your use case is indeed cheaper with serverless?
Today I will shine some light on how much an AWS serverless architecture could cost you. To help with that, we (at Theodo) created an easy to use but complete AWS serverless cost calculator! Maybe it will give you a little incentive to invest more in the technology.
⚠️ If you already know about TCO, FinOps and serverless architecture, you should directly jump to the calculator’s presentation (the link doesn’t work on mobile, go to the half of the page).
To understand the value of serverless think Total Cost of Ownership
One core concept often mentioned when talking serverless cost is the Total Cost of Ownership (TCO):
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 your monitoring tool
- development efforts, for generic features like authentication, tech maturity or 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 a concrete example:
- 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.
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. 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).
By 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
⚠️ This initiative is a continuous work in progress, it is based on our experiences at Theodo. So some scenarios or hypotheses might not reflect well your own use-case. Simplifying and generalising a way to calculate costs of complex systems is hard, and requires more learnings from experiences.
🙏 Please share your experience with us! Either will we give you tips on better practices, or you will teach us something that will help refine the calculator for the community. To contribute, you can leave comments in the original spreadsheet, in this article or contact me on Twitter.
The calculator is accessible here 🤘. You can access it as a “Commenter”, then duplicate it and try it on (note: dropdowns don’t work in “Commenter” mode).
The spreadsheet is divided into two types of tabs: The first tab is the main dashboard where you’ll get your total cost estimation. You fill in as-easy-as-can-be inputs and get a total cost and a per AWS service drill down.
You have two options here:
- Pre-defined: Select a scenario to get a very general idea of costs. You can go for an e-commerce with a high traffic, let us do the rest of the estimation and see the final result on the right in the “Pre-defined” green frame.
- Custom: Input finer grained variables based on your business specificities (type of features and users behaviour) then see the result in the “Custom” blue frame.
The other tabs are the detailed calculations of each AWS service used. It has a list of the AWS cost constants, the hypotheses we made for the calculation variables, a progressive detail of the calculations and of course the total at the end.
That’s where the magic of our calculator really operates. The amount of variables required when using the official AWS cost calculator is huge. Even when you know well those services, it still takes time to properly fill each of them. So from experience, by narrowing down basic use cases, we fixed certain services, certain variables and thus simplified the estimation process.
Straight cost benefits are obvious on small and medium-sized projects, but big and complex ones still benefit from the technology when considering the TCO.
Let’s take a shot at it together by going over some examples. We will try to see if serverless is worth it, and you’ll be able to compare those costs with your own.
For average traffics or below, we don’t need to calculate the TCO to witness serverless value
Low traffic: 50 sessions/day
Using the calculator, at this traffic a e-commerce app costs ~1.6$/month (free tier included), and a blog ~0.5$.
In comparison, the cost per month of the smallest EC2 VM, the t3a.nano, is 3.43$ (official EC2 pricing here).
Result: Advantage serverless, even more because it comes extra boosted with services. Compared to a VM, which is basic, where you’ll have to add a database, monitoring, manage scalability yourself, etc.
Medium traffic: 2k sessions/day
A serverless e-commerce app costs ~70$/month, and a blog ~20$.
The cost of one corresponding EC2 VM, like the m6g.large, is ~62$.
Result: Advantage serverless, for similar reasons as for low traffic.
High and very-high traffics are more difficult to evaluate but thinking TCO opens up serverless potential
High traffic: 40k sessions/day — Very high traffic: 1m sessions/day
A high traffic serverless e-commerce costs ~1.7k$/month, and a very high ~49k$.
A blog, respectively ~475$ and ~12k$.
Note for very high traffic: AWS offers important discounts not reflected here.
For such traffic, cost estimation becomes a bit more hazardous. Triple confirmation with some community and AWS folks who faced real world experiences showed similar costs (in magnitude) ✅.
Now, comparing VMs to a serverless architecture of this size is not as representative. Those systems are much more complex, in size and mix of technologies.
That’s where we can bring the TCO notion back. Deloitte says that, with serverless, systems maintenance time can be divided by 8. So for the sake of the exercise, let’s consider that a serverless Ops team is half the size of a more traditional one, and that a high traffic traditional website needs a team of 2 Ops.
The cost of one of those engineers for a company in Paris would be 140k$/year. This employee cost includes: her/his salary, the company-paid taxes, the healthcare participation, the office space rent and more. With serverless, our Ops team goes down to 1 Ops, which allows us to “save” 12k$/month.
Result: Still pretty positive for serverless: when you pay 1.7k$/month to AWS, being able to redirect 12k$/month to business differentiated tasks looks like a great idea!
Try it, challenge your status quo, and reach me for any question or improvement!
I hope this initiative gave you some new perspectives and answered or raised questions! That was the whole point: taking a step back, looking at the big picture with concrete examples and formulas, and witness together the potential of serverless.
What’s next? With this first release, we want to gather plenty of feedback and aim for a wider, easier-to-use version by the end of the year (a web application would be neat). We would definitely like to add other cloud providers to provide better context on vendor choice. If you’re interested in future developments of the tool follow me on Twitter.
- Lambda vs EC2: https://servers.lol
- Official AWS calculator: https://calculator.aws
- Lambda, Gateway, S3, CloudFront calculator: https://cost-calculator.bref.sh
- Cross-cloud FaaS calculator: http://serverlesscalc.com
Articles / Books
- A crazy AWS bill story: https://chrisshort.net/the-aws-bill-heard-around-the-world/
- Beg 2018 — Focus on FaaS, light detail about other services cost like gateway and vpc, plus the extra time needed to code (more lines): https://medium.com/@amiram_26122/6ced7844780b
- Very detailed Azure Functions cost calculus, applied to a simili-Facebook product which is way too expensive: https://dev.to/azure/is-serverless-really-as-cheap-as-everyone-claims-4i9n
- A more complete but fixed AWS serverless example with some warnings: https://techbeacon.com/enterprise-it/economics-serverless-computing-real-world-test
- AWS Hero famous article about the theory of TCO: https://theburningmonk.com/2019/01/you-are-thinking-about-serverless-costs-all-wrong/
- Lumigo’s FaaS focused ebook: https://lumigo.io/learn/aws-lambda-cost-guide/ or https://info.lumigo.io/serverless-cost-guide-ebook
- A very advanced FaaS vs EC2 comparison with calculus and graphs: https://www.bbva.com/en/economics-of--serverless/
- Deloitte’s white paper splitting the analysis of TCO in 3 sub-parties with concrete use cases on FaaS only: https://pages.awscloud.com/rs/112-TZM-766/images/AWS_MAD_Deloitte_TCO_paper.pdf
- Serverless too expensive experience: https://www.theregister.com/2019/09/24/serverless_tech_slower_and_8_times_more_expensive/
- Comparison between a Beanstalk .NET API (cheaper) and the same with Lambda and API Gateway: https://einaregilsson.com/serverless-15-percent-slower-and-eight-times-more-expensive/
- 2019 O’Reilly serverless landscape result: https://www.oreilly.com/radar/oreilly-serverless-survey-2019-concerns-what-works-and-what-to-expect/
- Serverless Coca Cola Case Study: https://dashbird.io/blog/serverless-case-study-coca-cola/
- Financial Engines Cuts Costs 90% Using AWS Lambda and Serverless Computing: https://aws.amazon.com/solutions/case-studies/financial-engines/
- Slower and more expensive: https://einaregilsson.com/serverless-15-percent-slower-and-eight-times-more-expensive/
- Estimating the Lambda + Gateway bill when migrating: https://serverlessfirst.com/ec-2-to-serverless-migration-calculator/
- Lambda cost analyser: https://github.com/alexcasalboni/aws-lambda-power-tuning