Cost Allocation: Tags, Cost Categories and Virtual Tags
import { Steps } from ‘@astrojs/starlight/components’;
Cost Allocation
Section titled “Cost Allocation”Xplorr gives you two ways to say who a cost belongs to:
- Tags. Break spend down by a tag key that your resources already carry, such as
teamorenv. - Cost categories. Write ordered rules that assign spend to values such as Platform, Data or Mobile, by account, service, region, resource name, tags and more. A category can be exposed as a virtual tag, which then works like a real tag key in Cost Analysis, budgets, unit metrics and exports, including for spend that carries no tags in the cloud.
Both live on the Cost Allocation page under Cost Management, on the Tags and Cost categories tabs. Rules are written on the third tab, Rules (it was the Teams and Tags page until 28 September 2026; the old address opens the tab).
Allocating by tag
Section titled “Allocating by tag”Where tags come from
Section titled “Where tags come from”Tags are read from your resource inventory on each sync, not from the bill:
| Provider | Source |
|---|---|
| AWS | Resource tags, read through the Resource Groups Tagging API (tag:GetResources) |
| Azure | Resource tags, read from Azure Resource Manager |
| GCP | Resource labels, read from Cloud Asset Inventory |
Tag overrides you set in Xplorr are merged with the cloud tags.
Which spend a tag can explain
Section titled “Which spend a tag can explain”A tag belongs to a resource, so only spend that the provider reports per resource can be matched to it. How much that is depends on the provider:
- AWS reports resource level cost for EC2 instances only, for the last 14 days, and only after resource level data is turned on in Cost Explorer settings. A FOCUS export configured under Cloud Accounts adds resource level spend.
- Azure resource costs come from Cost Management and fill in on the next sync.
- GCP needs the detailed usage cost export to BigQuery. The standard export has no resource level costs.
Reading the breakdown
Section titled “Reading the breakdown”Pick a tag key and a range of 7, 30 or 90 days. Spend falls into three kinds of row:
| Row | Meaning |
|---|---|
| A tag value | Resources carrying that value |
| Missing tag | Resources with a cost but no value for this key (counted in Untagged resources) |
| No resource | Billed spend not linked to any resource (counted in Unattributed) |
A large Unattributed share usually means the provider does not report that spend per resource (see above), not that your tagging is poor. To allocate it, use a cost category with rules on account, service, region or usage type.
Cost categories
Section titled “Cost categories”A cost category is a dimension you allocate spend to, such as Team, Business unit or Environment. It has:
- Values, for example Platform, Data and Mobile. Each value can have an owner email and a chargeback markup percent, and can be marked as a shared pool.
- Rules, in priority order, each assigning the cost it matches to one value.
- An optional shared cost split, which spreads the cost of shared pool values across the other values.
Unallocated is reserved. You cannot name a value Unallocated, because it is the name for spend that no rule matches everywhere a category or virtual tag appears.
Rules and conditions
Section titled “Rules and conditions”A rule has a name, the value it assigns cost to (Assign matching cost to), and one or more conditions. A rule matches only when all of its conditions match. A rule can have up to 20 conditions.
Fields a condition can test:
| Field | What it reads |
|---|---|
| Provider | AWS, Azure, GCP or a connected source |
| Cloud account | One of your connected accounts |
| Sub account | Linked account, subscription or project |
| Service | The billed service |
| Region | The billed region |
| Usage type | The provider’s usage type |
| Charge category | For example usage, tax or credit |
| Resource type | The resource’s type |
| Resource name | The resource’s name |
| Resource ID | ARN, Azure resource ID or GCP resource name |
| Tag or label | A resource, billing or Xplorr tag; you enter the tag key |
Operators:
| Operator | Matches when the field |
|---|---|
| equals / does not equal | Is, or is not, the value |
| is one of / is not one of | Is in, or not in, a comma separated list (up to 200 values) |
| contains | Contains the text |
| starts with | Starts with the text |
| matches pattern ( wildcard)* | Matches a pattern where * stands for any text, for example prod-* |
| matches regular expression | Matches a regular expression (see below) |
| is set / is not set | Has any value, or none |
Comparisons ignore case and extra whitespace, so Backend, backend and backend are the same value. A field with no value never matches equals, is one of, contains, starts with or either pattern operator, and always matches does not equal and is not one of.
Regular expressions and their limits
Section titled “Regular expressions and their limits”matches regular expression is for names that a wildcard cannot describe, for example ^prod-(web|api)-\d+$. It always ignores case, and it searches anywhere in the value unless you anchor it with ^ and $.
Some patterns can take a very long time to evaluate, so these limits apply:
- At most 200 characters.
- At most 20 repetitions (
*,+,?and{n,m}). - No backreferences (
\1,\k<name>). - No lookahead or lookbehind (
(?=,(?!,(?<=,(?<!). - A group that repeats cannot itself repeat or have alternatives inside it, so
(a+)+,(a*)*and(a|b)*are refused. - Only the first 1,024 characters of a value are tested.
The rule editor explains a refused pattern before you save, and the server checks it again. A saved pattern that no longer passes the checks never matches anything.
Priority: the first match wins
Section titled “Priority: the first match wins”Active rules run in priority order, top to bottom. Each piece of cost goes to the first rule that matches it; later rules never see it. Use the arrows on the Rules card to reorder rules, and the Active checkbox to pause one without deleting it.
Put narrow rules above broad ones. A rule for service equals Amazon RDS placed below a rule for account equals Production never receives any Production RDS cost.
Spend that no active rule matches is Unallocated. It stays visible as its own line rather than being spread silently across the values.
Preview a rule before saving it
Section titled “Preview a rule before saving it”The rule editor shows a live preview of the rule over the last 30 days (for the selected account, if one is selected), run in its place among the category’s other rules:
- Matches the cost the rule’s conditions match, and its share of the total.
- Runs as rule N of M, how much of that goes to the chosen value, and how much stays with earlier rules because the first match wins.
- Unallocated with this rule in place, the spend left over.
A paused rule is previewed as if it were active. The preview updates as you edit the conditions; nothing is saved until you click Save rule.
The Preview card below the rules runs the whole category over 7, 30 or 90 days, lists each rule’s matched and gross cost, and flags a rule whose conditions match nothing, or whose cost earlier rules claim entirely.
Shared cost split
Section titled “Shared cost split”A value marked as a shared pool, such as shared networking, can have its direct cost split across other values:
| Method | How the cost is split |
|---|---|
| Do not split | Shared values keep their cost and show as their own line |
| Even | Each target value receives the same amount |
| Proportional | In proportion to each target value’s direct cost in the same period |
| Fixed percentages | By percentages you set, up to 100 percent in total; anything below 100 percent stays unallocated |
With no target values selected, every value that is not a shared pool receives a share.
Reading a category
Section titled “Reading a category”On the Cost categories tab of Cost Allocation, pick a category and a cost metric (Billed, Amortized or List). The page shows:
- Allocation coverage by month: the share of spend matched by rules over the last six months.
- Cost by the category, and Allocation by provider with allocated and unallocated cost per provider.
- Values, with direct cost, shared cost received, allocated cost and share of total. The Showback tab reports allocated cost as billed; the Chargeback tab adds each value’s markup percent. Both download as CSV or Excel.
When less than half of the billed cost in the range is reported per resource, the page warns that rules on tags, resource names and resource types cannot match the rest.
Virtual tags
Section titled “Virtual tags”A virtual tag lets you filter and break down cost by a category as if it were a real tag key, even for spend that carries no tags in the cloud.
-
Open Cost Allocation, select the Rules tab, and select the category.
-
Tick Use as a virtual tag and enter a Tag key, for example
team. -
Save the category. The key now appears as a virtual tag on the category list and on Cost Allocation.
A virtual tag’s value for any cost is the value its category’s rules assign, after the shared cost split. Spend no rule matches has the value Unallocated.
Rules are evaluated when you look at the data, not stored with it. Editing a rule changes every past period the next time you view it, and nothing needs to be re-synced.
Cost by virtual tag in Cost Analysis
Section titled “Cost by virtual tag in Cost Analysis”The Cost by virtual tag card on Cost Analysis groups spend by a virtual tag over the page’s day range (30 days by default), for the selected account and cost metric:
- Choose the virtual tag.
- Group by value, or break each value down further By value and service, provider, cloud account, region or month.
- Filter to some values with Values.
- Download the result as CSV or Excel.
On the Tags tab of Cost Allocation, each virtual tag is also listed next to the tag keys. Selecting one shows the same breakdown as a real tag, with Unallocated in place of Missing tag.
Budgets and unit metrics scoped to a virtual tag
Section titled “Budgets and unit metrics scoped to a virtual tag”A budget or a unit metric can be scoped to one virtual tag (see Budget Alerts and Unit Economics):
- The scope picker suggests your virtual tag keys and their values, including
Unallocated. - One virtual tag per scope.
- Choosing values counts only the cost the rules assign to those values. Leaving the values empty counts every value except
Unallocated. - The rules are evaluated over each budget period or each metric’s range.
If the virtual tag is deleted, or a chosen value no longer exists, the budget or metric shows a warning and that part of the scope matches no spend. It never falls back to counting all spend.
Exporting a virtual tag
Section titled “Exporting a virtual tag”The CSV and Excel downloads from the Cost by virtual tag card have the virtual tag as a column of its own, named after its key, followed by the second dimension if you chose one, Cost, Share of total (%) and the currency. Spend no rule matches is the value Unallocated, and a total row closes the file. The file header states the rules came from which category, whether the shared split was applied, the values and period, and whether the rows were cut at 5,000.
The export is also available from the reports API as a chargeback grouped by virtual_tag, in CSV or Excel only (not PDF).
Step by step: allocating spend by team
Section titled “Step by step: allocating spend by team”-
Decide on the dimension, for example Team, and its values.
-
On Cost Allocation → Rules, click New category, name it
Team, and add the values. -
Add rules, broadest last. Start with rules that need no tags, such as by account or sub account, then add tag or resource name rules above them for shared accounts.
-
Watch the preview of each rule, and the Unallocated figure, as you go.
-
Tick Use as a virtual tag with the key
teamto use it in Cost Analysis, budgets and unit metrics. -
Check Allocation coverage by month on Cost Allocation and add rules for whatever remains unallocated.
Common mistakes
Section titled “Common mistakes”- A broad rule above a narrow one. The first match wins, so the narrow rule never receives anything. The preview shows how much cost stays with earlier rules.
- Relying on tag rules for spend that is not per resource. Tag, resource name and resource type rules cannot match spend the provider does not report per resource. Add rules on account, service, region or usage type for it.
- Inconsistent tag values. Case and whitespace are ignored, but
back-endandbackendare still two values. Use is one of, or define allowed values with Tag Governance.
Does changing a rule rewrite history? Nothing is rewritten, because nothing is stored. Rules are applied when you view the data, so a changed rule applies to every period you look at afterwards.
Can I use two virtual tags in one budget? No. A budget or unit metric scope accepts one virtual tag.
Can I allocate spend without any cloud tags? Yes. Cost category rules on provider, account, sub account, service, region, usage type and charge category need no tags.
Related guides
Section titled “Related guides”- Tag Governance for required tags and allowed values
- Budget Alerts for budgets scoped to a virtual tag
- Unit Economics for cost per unit scoped to a virtual tag
- Reports and Export for chargeback exports