Compartments are great for structural cost allocation, but they're hierarchical — a resource can only belong to one compartment. Tags provide a second dimension: flexible, multi-faceted labels that enable cost analysis across organizational boundaries.
Defined Tags vs. Free-form Tags
OCI supports two types of tags:
Defined Tags
Created within tag namespaces, with optional value constraints. These are managed centrally and enforce consistency.
Free-form Tags
Simple key-value pairs that anyone can create. Flexible but prone to inconsistency.
Our recommendation: Use defined tags for cost allocation. Free-form tags are fine for operational metadata, but for anything that affects cost reporting, consistency is critical.
Essential Tag Keys for Cost Allocation
1. CostCenter
Maps cloud spend to financial cost centers. This is the bridge between cloud costs and your chart of accounts.
•Example values: "CC-1001", "CC-2050", "CC-3200"
2. Project
Identifies which project or initiative a resource belongs to.
•Example values: "customer-portal", "data-pipeline", "mobile-app"
3. Owner
The individual or team responsible for the resource.
•Example values: "platform-team", "john.smith", "data-engineering"
4. Environment
The deployment environment. (This complements compartments if your hierarchy doesn't include environment.)
•Example values: "production", "staging", "development", "sandbox"
5. Application
The application or service that uses this resource.
•Example values: "api-gateway", "recommendation-engine", "auth-service"
Enforcement
Tags are only useful if they're consistently applied. OCI provides several enforcement mechanisms:
Tag Defaults
Automatically apply tags to new resources created in a compartment. Set a default value that users can override.
Required Tags
Mark tags as required when creating resources. This prevents untagged resources from being created.
Tag Validation
Define allowed values for tag keys. This prevents typos and inconsistency ("prod" vs "production" vs "Production").
Compliance Scanning
Regularly scan for untagged or mistagged resources. OCIFinOps can help identify resources that appear in cost reports without expected tags.
Using Tags in Cost Analysis
Once tags are consistently applied, you can slice your cost data along any dimension:
•"What does the customer-portal project cost across all environments?"
•"How much is the data-engineering team spending across all projects?"
•"What's the cost breakdown by cost center for Q1?"
In OCIFinOps, tags appear as dimensions in the cost explorer and can be used in natural language queries. Ask "What's the total cost for project data-pipeline?" and get an instant answer.
Getting Started
1. Define your tag taxonomy (start with 3-5 keys)
2. Create tag namespaces in OCI
3. Set tag defaults on key compartments
4. Scan existing resources and backfill missing tags
5. Set up regular compliance checks
Don't try to tag everything at once. Start with your highest-cost resources and expand from there. Even partial coverage provides valuable insights that you didn't have before.