$7K to Team A and $3K to Team B based on actual database usage from Datadog. Connect any usage metric, and Costory splits the cost proportionally. No manual percentages to maintain.

Key terms
- Shared cost allocation: The process of distributing a shared infrastructure cost across the teams or services that consume it, proportionally based on usage.
- Usage metric: An external measurement (e.g., database size per schema, CPU time per user, API calls per team) used to determine each team’s share of a shared cost.
- Virtual Dimension: A rule-based cost grouping. Shared cost allocation is configured as a special type of Virtual Dimension rule. See Virtual Dimensions.
Supported metric sources
Costory can pull usage metrics from several data sources to drive proportional cost allocation.Datadog
BigQuery
Snowflake
Google Sheets
How it works
Connect a usage metric source
Navigate to Setup > Usage Metrics and connect one of the supported sources (Datadog, BigQuery, Snowflake, or Google Sheets). See the Usage Metrics setup guide for details.
Create or edit a Virtual Dimension
Open the Virtual Dimension where you want to add shared cost allocation (e.g., “Team”). See Virtual Dimensions if you haven’t created one yet.
Add a metric-based rule
Select the usage metric you connected. Costory will use the metric’s values to determine each team’s proportional share of the cost.
Map metric dimensions to teams
Tell Costory how metric labels correspond to team names. Three mapping types are available (see below).
Apply
Costory reprocesses your data. The shared cost is split proportionally and appears in the Cost Explorer grouped by team.
Mapping metric labels to teams
When a usage metric has dimension labels (e.g., aschema label per database schema), you need to map those labels to the team names in your Virtual Dimension.
| Mapping type | How it works | When to use |
|---|---|---|
| Identity | The metric label already matches the team name exactly | Your metric labels and team names are the same (e.g., payments in both) |
| Regex | Extract the team name from the metric label using a regular expression | Labels follow a pattern like team-payments-prod and you need to extract payments |
| Manual | Explicitly assign each metric label to a team | Labels don’t follow a pattern, or you need full control over the mapping |
Common allocation patterns
Shared cost allocation works well for:- Shared databases (Cloud SQL, RDS, Aurora), split by schema size, query count, or connection time per team
- Network and egress costs, split by traffic volume per namespace or service
- Shared Kubernetes clusters, split by CPU or memory usage per namespace. See EKS/ECS visibility for a full example.
- Third-party API costs, split by API call count per team. See Reallocate API Costs for a walkthrough.
- Support and licensing fees, split proportionally based on each team’s share of total spend
Automate reporting
Once costs are allocated, you can automate weekly reports per team via Slack Reports. Each team sees their share of shared infrastructure alongside their direct costs, all in one place.For a step-by-step walkthrough, see Allocate a shared Cloud SQL database.
Next Steps
Virtual Dimensions
Build rule-based allocations and composable hierarchies
Allocate a Shared Database
Step-by-step: split a Cloud SQL bill across teams
Reallocate API Costs
Split shared API costs using an external usage metric
Usage Metrics Setup
Connect Datadog, BigQuery, Snowflake, or Google Sheets
