Every company at some point in time starts to calculate and analyze unit economics. It can be done to prepare for a new investment round or to monitor and improve the existing metrics. But if it’s not a big deal for private clouds, it may be tricky for public cloud environments like AWS, MS Azure and GCP, or Kubernetes clusters. In this article I’ll try to explain how to calculate the infrastructure aspect of the unit economics for different types of workloads.
Please keep in mind that the end formula for each company is different and depends on your business, product and what parameters you prefer to use. For example, you may use only the cost of the production environment but some companies can also add the R&D costs (including infrastructure) to the equation.
Unit economics for private clouds
For private clouds like VMware, Nutanix or bare metal, calculating unit economics is a pretty straightforward task, because a private cloud environment is not as variable or elastic as public clouds, we know how big our TCO is and we can calculate the economics. Here in the majority of the cases we take the TCO and divide it by the number of customers adding extra parameters into the equation, if necessary, like the cost of ads, marketing activities, datacenter lease etc.
Unit economics for public clouds
For public clouds it is a much more complex operation as we need to calculate a cloud cost for applications, we need to deal with cloud billing and use third-party cost management or cloud-native tools like AWS Cost Explorer or Azure Advisor. The best way is to assign a specific tag for all the resources in your application and to track costs based on it. Keep in mind that you need to deal not only with their existing resources but also with the destroyed resources in a selected period of time. If you have a multi-cloud or a hybrid cloud environment, then the task becomes more complex as you need to retrieve data from multiple sources and reiterate the calculations.
Unit economics for Kubernetes environment
For Kubernetes environments calculating unit economics is extremely difficult because you can’t map your cloud cost on pods, namespaces, services and applications in your Kubernetes cluster. You know how much you pay for nodes, you can calculate the cost of the whole cluster using the recommendations above depending on if your cluster runs in a private or a public cloud. But then you need to figure out how to distribute the cluster expenses between pods, services and applications. Also, it is a very complex task to track a pod creation and destruction to properly get historical data and calculate the cost for it. You need to use libraries like Prometheus and Cost Analyzer to get historical data and monitor information, calculate idle resources and divide the cost of Kubernetes nodes across pods at every moment of time. You need to have labels for all their applications, namespaces and services in your Kubernetes cluster so you can properly group the resources and expenses.
Our product, OptScale, can help with it, as it gives full visibility, optimizes IT costs and engages your engineers in cloud cost-saving, plus provides all the necessary Kubernetes or cloud environment cost details required to get accurate unit economics for Kubernetes and traditional workloads.