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.
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.
can not update beanstalk as it keeps looking for a deleted databaseasked 2 months ago
Connection to MariaDB server gets a timeout, out of nowhere.asked 3 years ago
Issues connecting to Postgres RDS instance from within a VPCasked 3 years ago
Accessing a RDS database in another account using AWS PrivateLinkAccepted Answerasked 4 years ago
Unable to enter create read replica page for a MySQL RDS instance inside classic EC2Accepted Answerasked 4 months ago
Am I billed while a RDS instance is starting/backing up?Accepted Answerasked 4 months ago
Use RDS Postgres Replicas as a clusterAccepted Answerasked 4 months ago
Error establishing a database connection with RDS and OpenLiteSpeed AIMsasked 4 months ago
Placing a Bastion in a Private Isolated Subnetasked 4 months ago
Split-Billing / Chargeback in a multi-tenant Database / RDS ServerAccepted Answerasked 3 years ago