Cost Attribution Foundations
Almost every cloud cost problem looks the same when you walk in: there is one big invoice and no agreed answer to who is spending what. Until that question has an answer, every conversation about waste is a guess.
This guide walks through the path we recommend in QueryWise, in the order that produces the fastest wins:
- Establish a baseline by vendor and service.
- Discover what tags already exist on your accounts.
- Define a small allocation policy and enforce it on new accounts.
- Roll up cost centers for chargeback or showback.
You can do this in an afternoon if your tag situation is healthy, or across a few sprints if it is not.
1. Start from a baseline
Before tags, get a clean baseline. Connect your billing sources (AWS, GCP, Azure, Snowflake, Databricks, MongoDB Atlas, Redshift, Synapse, Cosmos DB, Oracle) under Settings → Cloud Accounts and let the first sync complete.
Once billing is flowing, the Costs page gives you the canonical breakdown — by vendor, service, and time. That is the denominator for everything else: every allocation policy you write needs to add up to this number.
If a chunk of spend stubbornly refuses to be classified, that is fine. We treat it as untagged rather than forcing it into a bucket.
2. Discover what tags already exist
QueryWise extracts tags from billing data on every sync — labels on GCP, tags on AWS/Azure, TAG_REFERENCES on Snowflake, query tags on Databricks. The tags appear at Allocation → Tag Discovery.
The discovery view answers two questions:
- Coverage: what percent of spend has each tag applied?
- Cardinality: how many distinct values does each tag have?
A healthy estate has a handful of high-coverage, low-cardinality tags (env=prod|staging|dev, team=..., cost-center=...) and avoids low-coverage tags with hundreds of unique values (which usually means somebody freeformed the field).
If your coverage is below ~70% on the tags you care about, fix that before trying to write allocation rules. Otherwise you are allocating the visible portion of your bill and inventing a story for the rest.
3. Define an allocation policy
Once tags are stable, head to Settings → Tag Policies and write the smallest policy you can defend:
- Required tags per vendor (e.g.
env,teamare required on every AWS account) - Allowed values for each tag
- Default values for accounts that don't comply
Tag policies in QueryWise enforce at account creation time — a cloud account that doesn't satisfy the policy can't be added. That keeps the wall from cracking after you've patched it.
For existing untagged spend, you have two options:
- Backfill at the source (preferred, but politically slow).
- Define allocation rules in QueryWise that map account/service/region patterns to tags. These rules run at query time and don't modify upstream data.
We recommend doing both: backfill where you can, write rules to cover the rest.
4. Roll up to cost centers
A cost center is the business object you actually want to chargeback against — a product line, a customer, a department. It's usually a combination of tags rather than a single tag.
In Settings → Cost Centers, you define a cost center as a tag filter:
Cost center: data-platform
Filter: team=data AND env=prod
Owner: priya@example.com
Cost centers feed two views:
- Allocation → Chargeback — full chargeback report with CSV export for finance
- Budgets — set a budget per cost center, get alerts when burn crosses thresholds
5. Don't skip the unit economics step
Total cost per cost center is interesting but not actionable. The next step is cost-per-unit — cost per customer, cost per query, cost per pipeline run.
QueryWise computes these on the Allocation → Unit Economics tab if you've tagged a meaningful business dimension (customer_id, pipeline_id). You don't need to do anything special — once the tag is on the cost data, the math runs itself.
This is the number that gets engineering to actually optimize: "we're at $0.47 per order — last month we were at $0.31, here's the queries that drove it" lands very differently than "Snowflake is up 12% MoM."
What tends to go wrong
Treating tag policy as a one-time project. It's a forever-process. New services launch every quarter; your policy needs to grow with them.
Allocating by service or region. It feels easier than tagging but it's a dead end — service-based allocation answers "where did the money go" but not "who should pay for it."
Chargeback before showback. Engineers will fight chargeback if they don't trust the numbers. Run showback for a quarter, fix the inevitable allocation disputes, then turn on chargeback.
Where to next
- Right-Sizing and Auto-Suspend — once you know who's spending, you can right-size their workloads.
- Chargeback and Showback — design the report finance will actually use.