Tagging strategy: getting the most from tags
How to tag cloud resources, enforce tagging, and when to use cloud tags or virtual tags in CostGlass.
Tagging strategy: getting the most from tags
How to label your cloud resources so every pound of spend can be traced to a team, a product or an environment, and how CostGlass uses those labels.
- A tag (called a label on Google Cloud) is a small key and value pair, such as team = payments, that you attach to a cloud resource.
- Tags are how a bill is split by team, product or environment. Untagged resources are spend nobody owns.
- Start with a short, agreed set of tags, enforce it in your cloud, and set it by default in your infrastructure-as-code.
- Today CostGlass reads tags into cost views for AWS and Oracle Cloud. For other clouds, use Virtual tags to allocate spend without tagging.
- Cloud tags and virtual tags work together: tag what you can at the source, use virtual tags to cover the rest and the shared costs.
What a tag is
A tag is a key and a value that you attach to a resource such as a virtual machine, a database or a storage bucket. For example, the key team with the value payments. Your cloud provider copies tags onto the bill (in some cases only after you switch this on), so cost can be grouped by them. Google Cloud calls them labels and Oracle Cloud has defined tags and free-form tags. This guide says "tag" for all of them.
Why it matters: a cloud bill is organised by service (for example "virtual machines"), but your business thinks in teams, products and environments. Tags connect the two. Without them, a finance person looking at a large bill cannot tell who should explain it.
How tags work in each cloud
| Cloud | What they are called | What to know |
|---|---|---|
| AWS | Tags | You can add tags to most resources. For a tag to appear in your cost data it must be activated as a cost allocation tag in the AWS Billing console (Billing → Cost allocation tags). The Cost and Usage Report (CUR) only includes user-defined tags that you have activated. Activation is not retroactive: a tag shows up from the time you activate it, so activate your standard tags early. |
| Azure | Tags | Tags are set per resource, resource group or subscription. Azure does not copy a resource group's tags to its resources by default, so a resource can be untagged even when its group is tagged. Azure Policy can add or inherit tags automatically. |
| Google Cloud | Labels | Labels are attached to resources and projects. They appear in the billing export for the services that support them. Label keys are lowercase letters, numbers, hyphens and underscores. |
| Oracle Cloud (OCI) | Defined tags and free-form tags | Defined tags live in a namespace you create and can be controlled by policy. Free-form tags are simple key and value pairs. Cost reports carry both. |
| Alibaba Cloud, DigitalOcean, Linode | Tags | These clouds support tags on resources, but the billing data CostGlass reads from them does not carry per-resource tags today. See the table below. |
| Cloudflare, OpenAI, Anthropic, Datadog, Snowflake | Not applicable | Their billing has no tags. Group their spend with their own structures (projects, workspaces, zones) or with virtual tags. |
A recommended minimum tag set
Resist the urge to invent many tags. Five or six that everyone follows are worth far more than twenty that nobody does. A good starting point:
| Key | Question it answers | Example values |
|---|---|---|
owner | Who do we ask about this resource? | a team mailbox such as [email protected] |
team | Which team pays for it? | payments, search, data |
environment | Is it production or something else? | prod, staging, dev |
application | Which product or service is it part of? | checkout, reporting |
cost-centre | Which budget line does it belong to in finance? | a code your finance team already uses |
Environment, Owner, Project and CostCenter. You can change them to match your own standard.Naming conventions and case
- Pick one style and write it down. For example all lowercase with hyphens:
cost-centre. Do not mixCostCentre,cost_centreandcostcentre. - Agree the allowed values for tags with a small set of answers (
environmentisprod,stagingordev, not alsoProductionandproduction). - Never put secrets or personal data in tags. Tags are visible to anyone who can see the resource and appear on bills.
- Keep values short and stable. A tag value that changes every week splits history into many groups.
Case sensitivity
Tag keys are case sensitive in most clouds: Team and team are two different keys. Billing exports can also change the case. For example, the AWS CUR 2.0 format lowercases tag keys and turns punctuation into underscores, so Name becomes name. The values are kept exactly as written.
CostGlass matches tag keys case-insensitively (in Tag Explorer, Tag Compliance and in virtual tag rules), so a mix of cases still lands in the same group. Even so, one consistent spelling in your cloud avoids confusion elsewhere.
Making sure tags actually get applied
Asking people to tag is not enough. Add a guard so an untagged resource is hard to create. These are general descriptions; follow your cloud's own documentation for the exact steps.
- AWS: Tag Policies and SCPs
- In AWS Organizations, a tag policy defines allowed keys and values and reports non-compliance. A service control policy (SCP) can deny creating certain resources when a required tag is missing from the request.
- Azure: Azure Policy
- Built-in policies can require a tag on resources, add a tag automatically, or copy a tag from the resource group. Use "modify" or "inherit" style policies to fix gaps without blocking people.
- Google Cloud: organisation policy and labels
- Use organisation policies and your deployment pipeline to require labels on projects and resources. Labels are often easiest to enforce at the project level.
- Oracle Cloud: tag defaults
- Tag defaults in a compartment apply defined tags automatically to new resources, and a tag can be marked required.
Set tags in your infrastructure-as-code
If your resources are created by code, the cleanest fix is to set the tags there once, for everything. With Terraform's AWS provider you can set default tags at the provider level, so every resource it creates inherits them:
Other providers have similar settings or modules. Use them rather than copying tags onto each resource by hand.
Fixing what already exists (retro-tagging)
- Find the gaps with Tag Compliance (AWS) or the "(untagged)" row in Tag Explorer.
- Start with the biggest spend, not the largest number of resources. Ten untagged databases can cost more than a thousand small items.
- Tag in bulk using your cloud's tagging tools, a script or the commands CostGlass generates, then check again.
- Fix the source (your code or policy) so the gap does not come back.
How CostGlass uses your tags
| Where | What it does with tags |
|---|---|
| Tag Explorer | Groups what each cloud billed by the value of one tag key, with coverage and a drill-down to resources. |
| Tag Compliance | Checks your AWS resources against a list of required tags and helps you fix gaps. |
| Cost Explorer | Choose Group by then a Tag: … entry to group by an AWS cost allocation tag. This one reads live AWS Cost Explorer data, so it needs an AWS connection that uses a role. A CUR-only connection returns an explanation instead of numbers. |
| Virtual tagging | Rules can match on a cloud tag, or take their value from one, so your real tags drive the allocation. |
Which clouds' tags reach CostGlass today
This is the honest picture at the time of writing. Tag Explorer shows the same information per cloud on screen, under Tag coverage by cloud.
| Cloud | Tags in CostGlass cost data? | Notes |
|---|---|---|
| AWS | Yes | Tags come from the resources in your Cost and Usage Report. Activate your tags as cost allocation tags in AWS first, then import a fresh report. |
| Oracle Cloud | Yes | Tags come from the tag columns of the Oracle cost report. |
| Azure | Not yet | The Azure cost data CostGlass reads carries no resource ids or tags, so tags cannot be tied to billed cost. |
| Google Cloud | Not yet | Billing export labels are not read yet. |
| Alibaba Cloud | Not yet | Bill files are not read for tags yet. |
| DigitalOcean, Linode | No | Invoices carry no resource ids or tags. |
| Cloudflare, OpenAI, Anthropic, Datadog, Snowflake | No | Their billing has no tags. |
| Kubernetes | No | Spend is grouped by cluster and namespace in Cost Explorer; workload labels are not part of billed cost. |
Cloud tags or virtual tags?
- Set on the resource itself, so every tool sees them.
- Best for ownership, environment and application.
- Not retroactive; need discipline and enforcement.
- Cannot split a cost that has no resource (support, tax, shared networking).
- Rules applied to billed cost; no change to your cloud.
- Edits re-allocate all history immediately.
- Works on every cloud and on SaaS and AI spend.
- Can combine accounts, services, regions and cloud tags in one rule list.
A company tags team and environment on AWS resources through Terraform default tags. In CostGlass it creates a virtual tag called Team whose first rules take the value from the team cloud tag, then adds rules by account for the Azure subscriptions it has not tagged yet, and a final fallback value of "Shared". One report now shows every team across both clouds.
A short rollout checklist
- Agree the minimum tag set and naming style with engineering and finance.
- On AWS, activate the tags as cost allocation tags in the Billing console.
- Set the tags as defaults in your infrastructure-as-code.
- Add a policy (tag policy, Azure Policy, organisation policy) so untagged resources are flagged or blocked.
- Enter the required tags in Tag Compliance and run a clean-up campaign.
- Use Tag Explorer to watch coverage rise and virtual tags to cover the rest.