By using AWS re:Post, you agree to the Terms of Use
/Split-Billing / Chargeback in a multi-tenant Database / RDS Server/

Split-Billing / Chargeback in a multi-tenant Database / RDS Server



I've fielded a question a few times that's generally along the lines of:

I have a single RDS (or EC2) instance for my multi-tenant SaaS application. I know the total spend by department/system based on cost allocation tags, but I want to know cost by tenant for a chargeback model.

My response is that - well, there are a lot of way to do this but it ultimately comes down to combining data from the server. For example, you could use any one (or combination of) query counts, query times, storage usage, etc. by database user (or group/schema/etc), export that to S3, and combine that with the cost and usage report from AWS using Athena/Spectrum/etc. There's no "out-of-the-box" AWS solution for split billing / chargebacks in RDS... this would be custom development

My question is: has anyone seen any good open source examples or partner solutions for this scenario?

Though question is focused on database billing, if you've seen things for related services (e.g. EC2, ECS, Lambdas, etc.), that would also be of interest.

1 Answers
Accepted Answer

I would design for one lead metric, which is the main driver for infrastructure costs (infrastructure in this case is the underlying shared DB instance). Then you can have secondary metrics, if user behavior needs to be limited / steered also regarding a second factor. An example for this is EBS, where capacity is the main metric that determines the pricing, while IOPS are a secondary metric.

The advantage of this use case is, that the tenants are (presumably) all using the same SaaS application, so the load which they are generating is probably comparable, making it easier to define a lead metric.

When you have your lead metric you can use that to split the costs of the service to the individual users. For that you have multiple inputs:

  • The direct costs from the instance, where the DB is hosted
  • The indirect/non-tagable costs from the account, where the DB is hosted (e.g. network traffic)
  • The indirect costs form the platform operations (e.g. direct connect, identity provider connection, central logging account, ...)
  • The non-AWS costs for running the service (e.g. license, personnel costs, ...)

That means they have to build it by themselves but it can be partially automated, e.g. if they can import their personnel costs form their ERP system, or provide the CURs to the account owners.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions