We run a multi-tenant product on a shared EKS cluster with a shared database. Tenants are separated at the application level using a tenantId, and each request identifies the tenant through a header or domain. I can calculate overall AWS and service costs, but I'm struggling to produce a defensible per-tenant breakdown. My current idea is to use Kubecost for service and pod costs, allocate shared service costs according to each tenant's request volume, assign CDN and data-transfer costs based on bytes per tenant domain, and divide database costs using each tenant's row or storage share. What allocation model would you recommend, and how precise should this reporting be?
3 Answers
Separate costs into directly attributable usage and shared overhead. Tenant-specific storage, egress bytes, and domain traffic can usually be assigned fairly directly. Shared EKS capacity, database CPU, caching, monitoring, and idle headroom need allocation drivers based on actual consumption rather than one request percentage for everything. Add tenantId to traces and collect metrics such as request duration, CPU time, query time, rows scanned, storage, and transferred bytes. Then use those metrics to distribute each cost category with the most appropriate weighting.
Perfect precision may not be worth the complexity. A practical model is to calculate infrastructure cost divided by a representative usage unit, such as active users, requests, compute time, storage, or data transferred, depending on the product. Use separate formulas for fixed platform overhead and variable usage, smooth month-to-month fluctuations, and round the result if the number is being used for pricing rather than internal analysis.
AWS cannot identify application-level tenants inside shared resources by itself. If tenants use separate AWS resources, tags and billing dimensions can provide direct attribution. With a shared cluster and database, you need custom metering: record tenant activity in a usage table or data lake and calculate periodic allocations from it. Keep the calculation reproducible so customers can understand which usage measurements produced their share.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures