Compartments are the backbone of cost attribution on OCI. They are logical containers that hold resources, and because OCI stamps every cost record with the compartment its resource sits in, your compartment hierarchy is the structure you read the bill by. Get the hierarchy and a tagging standard right at the start and you can attribute every dollar to a team, environment, or application; get it wrong and the bill becomes an undifferentiated total that no one can act on. Budgets, alerts, and chargeback all read from this structure, so compartment design is cost design, not just security design.
This is the buyer side map of how OCI compartments and tags shape the bill, how to structure them for visibility, and how budgets attach to the result.
What is a compartment and why does it shape cost?
A compartment is a logical, global container for OCI resources. It is not tied to a region, it can be nested several levels deep, and every resource you create lives in exactly one compartment. Identity policies attach to compartments, so they are also the security boundary. The cost consequence is simple: the Cost Analysis console and the detailed usage and cost reports both let you group spend by compartment, so the tree you design is the set of cost buckets you will live with. If production and non production sit in the same compartment, you cannot separate their spend without extra tagging. If every team shares one compartment, the bill cannot be read by team. Compartment structure is the first decision that determines whether OCI cost is legible.
How should you structure compartments for cost visibility?
There is no single correct tree, but there is a useful default: a top level compartment per business unit or product, with environment sub compartments beneath it. That gives you spend by unit and by environment in two clicks, which are the two cuts finance asks for first. The tension is between granularity and overhead. Too flat and you lose the ability to attribute; too deep and you drown in administration and policy sprawl. Pick the shallowest tree that answers the questions you actually need to answer.
| Structure | Cost cut you get | Best for |
|---|---|---|
| By environment (prod, non prod) | Spend by lifecycle stage | Small estates, one team |
| By business unit, then environment | Spend by unit and stage | Most enterprises |
| By application, then environment | Spend per application | Product led organisations with clear app boundaries |
| Flat, single compartment | Total only | Avoid for any estate you need to charge back |
Whatever tree you choose, decide it before the estate grows. Moving resources between compartments is possible but disruptive, and policies, budgets, and reporting all have to be rebuilt around the new shape.
Compartments or tags: which does what?
Compartments and tags are complementary, and a real cost model uses both. The compartment is a structural boundary: it is hierarchical, it is also a security scope, and a resource can only live in one. That makes it the right home for coarse, stable dimensions such as business unit and environment. Tags are flexible labels that cut across the tree: a single application, cost center, or owner can appear in many compartments, and only a tag can carry that dimension cleanly. OCI offers free form tags and defined tags, and you can mark certain tags as cost tracking tags so they surface in usage reports and budgets. The practical rule is that compartments answer who owns the resource and tags answer what it is for.
Pick any line in last month's OCI bill and ask which team pays for it and which application it serves. If the compartment answers the first and a cost tracking tag answers the second without anyone guessing, your structure is sound. If either question needs a spreadsheet and a meeting, the structure is the problem, not the bill.
How do budgets and alerts attach to this structure?
OCI Budgets target either a compartment or a cost tracking tag. You set a monthly budget amount and one or more alert rules that fire on actual spend or on forecast spend at a chosen percentage of the budget. Because budgets read the same compartment and tag structure as Cost Analysis, a clean hierarchy means you can stand up a budget per business unit in minutes and route the alert to the team that owns it. A messy hierarchy means budgets are either too coarse to be useful or too manual to maintain. This is the payoff for getting the structure right: governance becomes configuration rather than a standing project.
A worked example
A European SaaS company ran its entire OCI estate in two compartments split only by region, so finance could see a regional total and nothing else. We rebuilt the tree as a compartment per product line with production and non production sub compartments, added cost tracking tags for cost center and application, and attached a forecast based budget to each product compartment. Within a billing cycle, spend was attributable per product and per environment, idle non production resources became visible and were scheduled off, and budget alerts reached the owning teams before overruns rather than after. Figures are verified against billing data and anonymized.
Where to go next
Once the structure is in place, turn it into reporting with multi compartment cost reporting, and make the tags reliable with tagging for cost allocation on OCI. The full set of OCI levers sits in the OCI cost optimization guide, and the way the same attribution problem plays out on AWS, Azure, and GCP is covered in the cross cloud cost optimization guide.
Frequently asked questions
What is a compartment in OCI?
How do OCI compartments affect billing?
Should you organize OCI by compartment or by tag?
Take the next step on your cloud spend
We are an independent buyer side advisory that cuts public cloud spend across AWS, Azure, GCP, and OCI. We hold over $2.4B in annual cloud spend under management, take zero provider commissions, and deliver a 31 percent median reduction in the first 90 days. Our guarantee is simple: we reduce your cloud spend or we reimburse our service fee. Pricing is either a Fixed Fee scoped up front or Gainshare, a share of verified savings with no retainer and no risk to you.
Put a defensible number on your cloud spend.
No provider in the room, no published price list. Tell us your footprint and we will scope the savings against your billing data — we reduce your cloud spend or we reimburse our service fee.
The Cloud Spend Navigator: what changed in cloud pricing, commitments, and FinOps — no vendor spin.