Total Cost of Ownership in the Cloud
Your monthly bill shows you the obvious, regular cost of running your serverless application in the cloud. There is, however, another cost: the cost of ownership.
Total cost of ownership (TCO) is an established concept that helps organizations understand the cost of software over time, not just at the point of acquisition or creation. TCO can be significantly diminished when using serverless technology, primarily through leveraging managed services with a pay-per-use pricing model. But there are still key costs beyond your monthly bill that should be incorporated into your estimates and budgets.
When assessing your serverless TCO, you should consider the following costs:
Engineering
The cost of the humans who design, build, and operate the application. This will in all likelihood be your most significant cost. Optimize your tools, process, and delivery to ensure your team spends time working on the things that generate value (see Chapter 6 for tips on optimizing your implementation, Chapter 7 for testing, and Chapter 8 for delivery and operations).
Delivery
The cost of delivering code iterations to your users. The longer delivery pipelines run, the more they cost. The longer your fixes take to deploy, the longer your bugs live in production and potentially adversely affect your business.
Operations
This is the cost you’ll see on your monthly bill. Every piece of code you deploy will have an operational cost: storage, compute, data transfer, and so on. This cost will scale with your traffic due to the serverless pay-per-use model, but there will be other constant costs, such as monitoring (see “Avoiding Serverless Cost Gotchas” on page 388) and security.
Maintenance
The cost of maintaining the application over time. The amount of hours dedica‐ ted to maintenance, as opposed to new feature development, will depend on factors such as complexity of the codebase, collective knowledge of the codebase among the team, and stability of the application. Software is maintained for much longer than the time it takes to create it.
Ownership of software is essentially ownership of the lines of code that have been contributed to the source code. It is commonplace in the software industry to view lines of code and the number of contributions to a codebase as measures of success and productivity. Many think the more code, the better. In fact, running software in production for a long period of time has proven the opposite to be true: code is a liability.
As you have seen, TCO can attribute a cost to every line of code in your codebase: the cost of creating it, deploying it, operating it, and maintaining it. Reducing your total cost of ownership is all about reducing the amount of code you own and simplifying what is left. As the authors of The Value Flywheel Effect put it: “not unlike poetry, extraordinary code is elegant and precise.”
There will be broadly three types of code in your software inventory:
Production code
Code that runs in production. This is the code you want to own and keep as simple as possible. This code delivers features to your users and generates value for your organization.
Non-production code
Code that does not run in production. If code is not being executed by the actions of your users it is not generating value. This code should be kept to an absolute minimum and be purely dedicated to ensuring the stability of your application.
Third-partycode
Code that runs in production but is written by someone outside your organiza‐ tion. This is also code that you want to minimize (see “Think before you install” on page 186). Integrating this code, especially after major or minor updates to the library, can often demand a high investment of time and energy. Bugs introduced by third-party code can also be fiendishly difficult to isolate and usually depend on someone else to fix and release.
Now that you’ve taken a zoomed-out look at your total costs, let’s focus on the two pillars of serverless cost on AWS: compute and storage.