Multi-tenancy is one of the key properties of any effective SaaS solution. It gives companies the economies of scale, elasticity, and operational efficiency to offer competitive products with strong margins.
However, multi-tenancy has a tradeoff: cost visibility. Because customers share AWS resources in multi-tenant architecture, the billing data shows the resources you’ve utilized, but not by who or to do what.
It’s possible to build this kind of visibility in. In fact, many of the best run SaaS companies have openly discussed how they’ve done this.
However, many companies neglect to consider it during design and development. This leaves them making "best guesses" when it comes to key financial metrics — like how much it costs to serve enterprise customers versus small businesses or whether their unit economics are improving even as cost goes up. Without actually understanding how much it costs to serve products to your customers — you’re probably leaving money on the table.
The entire document is 59 pages and definitely worth the read for any technical team at a SaaS company. However, we couldn’t help but notice that calculating cost per tenant required an awful lot of custom work — while CloudZero offers it to our customers out of the box.
In this post, I’d like to give a quick overview of the SaaS Lens’ cost per tenant section, as well as how CloudZero can help you meet the requirements without building a custom tool to do it yourself.
It's easiest to think of a tenant as a customer of your software. Depending on how you have architected your system, a single tenant might account for all of your users or just one. You grant a tenant certain access rights and feature entitlements based on the products and features you have sold to them.
While the business can usually track booked revenue and licensing agreements, the challenge is tracking the ongoing cost to deliver products and services to that tenant. Without granular visibility into cost, you can calculate profit margins on total cost and revenue, but it’s impossible to know your net profit margins on product features, individual customers, and more.
Regardless of where you are in your SaaS journey, it’s never too early to think about measuring your cost per tenant. It’s common for companies to wait until later in their life to start, but that can come at a great cost.
First of all, a lack of visibility into cost per tenant means you’re left to make decisions without accurate data. For example, your product teams will choose pricing models, your sales teams will decide on renewal contracts, and your engineering team will decide where to prioritize resources — all without understanding the true cost and margins of those decisions. Additionally, like anything in DevOps building in observability as you go is always easier than later.
The AWS Well-Architected Framework is organized into five pillars and provides some of the best guidance on building well-architected software on AWS.
AWS's most recent addition, the SaaS Lens, goes into detail on how best to think about building expenditure awareness into your SaaS applications and divides the activities into two sections, capturing tenant consumption metrics and correlating consumption with infrastructure costs.
Here’s how you can obtain these metrics for yourself.
The first step is to determine if your application is already properly instrumented or if new instrumentation will be required to track the activity of your tenants. Most organizations already have systems in place to track system performance or user activity.
For cost per tenant, you’ll specifically need to find a point in your infrastructure that processes requests, where you can extract a unique customer ID and an understanding of how that customer is consuming resources at that moment.
Here’s a few examples of where our customers have found this:
It may take a bit of discovery with your engineering team, but in our experience, there’s always at least one DevOps engineer who knows your system extremely well — and when you ask them they’ll know exactly what we’re talking about.
Once you have your data source, you’ll need to format it so it can be correlated with cost data. In this section, I’m going to speak to specifically how we work with our customers to do this — although there are many ways you can achieve it if you’re looking to measure cost per tenant.
We provide our customers with a simple JSON, which transforms consumption metrics into a new metric, which we call unit cost activity (UCA).
For example, the following UCA event describes the activity (23ms of compute) of a single customer (CustomerID-2) using one feature (search) of the system under observation.
Once you are able to record or transform the activities of your tenants into UCA format, CloudZero can then ingest and aggregate the events.
Please note, if you’re using the CloudZero platform, we also offer automatic tagging assistance to organize your costs in products and features so the following assumes you’ve already taken that step.
Our engine correlates your cost data with your tenants’ consumption of features. This produces a metric that shows you how much each of your tenants cost you per product feature.
In order to produce your cost per tenant data, you’ll need to put it into an S3 bucket for us to access. There are a number of ways for you to do this, depending on your architecture and preference.
Borrowing from the AWS SaaS Lens, the following reference architecture uses Amazon CloudWatch, AWS Lambda, Amazon Kinesis Firehose, and Amazon S3 can be used.
Alternatively, you could also choose to send metrics directly however you want to S3 for CloudZero to analyze.
Once CloudZero receives the unit cost activity events, it then aggregates the data into a summary of usage for each hour by tenant ID and feature.
For each customer, you’ll also be able to see cost per feature.
Here’s how it looks when all of the pieces are put together. Please note that once the data is in the S3 bucket, CloudZero will process the rest automatically.
You then have the option to put it into your BI tool of choice to track customer cost over time or correlate it with important business metrics, such as revenue.
This year CloudZero launched the SaaS industry's first automated solution for tracking cost per tenant. Providing the key platform necessary to build cost per tenant tracking into your software.
SaaS companies looking to understand their per-customer costs are no longer forced to build and maintain homegrown systems, often at great cost to engineering velocity.
With CloudZero, our customers can automate and manage this complex process without taking time away from more important tasks.