Skip to content

Cost Allocation: Tags, Cost Categories and Virtual Tags

import { Steps } from ‘@astrojs/starlight/components’;

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 team or env.
  • 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).

Tags are read from your resource inventory on each sync, not from the bill:

ProviderSource
AWSResource tags, read through the Resource Groups Tagging API (tag:GetResources)
AzureResource tags, read from Azure Resource Manager
GCPResource labels, read from Cloud Asset Inventory

Tag overrides you set in Xplorr are merged with the cloud tags.

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.

Pick a tag key and a range of 7, 30 or 90 days. Spend falls into three kinds of row:

RowMeaning
A tag valueResources carrying that value
Missing tagResources with a cost but no value for this key (counted in Untagged resources)
No resourceBilled 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.

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.

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:

FieldWhat it reads
ProviderAWS, Azure, GCP or a connected source
Cloud accountOne of your connected accounts
Sub accountLinked account, subscription or project
ServiceThe billed service
RegionThe billed region
Usage typeThe provider’s usage type
Charge categoryFor example usage, tax or credit
Resource typeThe resource’s type
Resource nameThe resource’s name
Resource IDARN, Azure resource ID or GCP resource name
Tag or labelA resource, billing or Xplorr tag; you enter the tag key

Operators:

OperatorMatches when the field
equals / does not equalIs, or is not, the value
is one of / is not one ofIs in, or not in, a comma separated list (up to 200 values)
containsContains the text
starts withStarts with the text
matches pattern ( wildcard)*Matches a pattern where * stands for any text, for example prod-*
matches regular expressionMatches a regular expression (see below)
is set / is not setHas 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.

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.

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.

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.

A value marked as a shared pool, such as shared networking, can have its direct cost split across other values:

MethodHow the cost is split
Do not splitShared values keep their cost and show as their own line
EvenEach target value receives the same amount
ProportionalIn proportion to each target value’s direct cost in the same period
Fixed percentagesBy 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.

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.

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.

  1. Open Cost Allocation, select the Rules tab, and select the category.

  2. Tick Use as a virtual tag and enter a Tag key, for example team.

  3. 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.

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.

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).

  1. Decide on the dimension, for example Team, and its values.

  2. On Cost Allocation → Rules, click New category, name it Team, and add the values.

  3. 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.

  4. Watch the preview of each rule, and the Unallocated figure, as you go.

  5. Tick Use as a virtual tag with the key team to use it in Cost Analysis, budgets and unit metrics.

  6. Check Allocation coverage by month on Cost Allocation and add rules for whatever remains unallocated.

  • 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-end and backend are 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.