OCI2025-02-288 min read

Designing an OCI Compartment Strategy for Effective Cost Allocation

Your compartment hierarchy is the foundation of cost allocation on OCI. Here's how to design one that gives you clear, actionable cost visibility.

OT

OCIFinOps Team

Compartments are OCI's primary mechanism for organizing and isolating resources. But they're also your most powerful tool for cost allocation. A well-designed compartment strategy can mean the difference between "our cloud costs are $50K/month" and "Team Alpha's production database costs $12K/month, which is 15% above budget."

Why Compartments Matter for Cost Allocation

Every OCI resource lives in a compartment, and every cost report line item includes the compartment name. This makes compartments a natural dimension for cost analysis. Unlike tags (which are optional and often inconsistent), compartments are mandatory — every resource must belong to one.

Common Compartment Strategies

Strategy 1: By Environment

Root

├── Production

├── Staging

├── Development

└── Sandbox

Pros: Simple, clear separation of environments

Cons: Doesn't tell you which team or application is spending

Strategy 2: By Team

Root

├── Platform-Engineering

├── Data-Science

├── Application-Team-A

└── Application-Team-B

Pros: Direct team-level cost accountability

Cons: Shared services (like networking) don't fit cleanly

Strategy 3: Hybrid (Recommended)

Root

├── Shared-Services

│ ├── Networking

│ ├── Security

│ └── Monitoring

├── Team-Alpha

│ ├── Production

│ ├── Staging

│ └── Development

├── Team-Beta

│ ├── Production

│ ├── Staging

│ └── Development

└── Sandbox

Pros: Team accountability + environment visibility + shared service tracking

Cons: More complex to manage

Best Practices

1. Plan Before You Build

Restructuring compartments after resources are deployed is painful. Design your hierarchy upfront with cost allocation in mind.

2. Limit Depth

OCI supports compartments nested up to 6 levels deep, but 3 levels is usually the sweet spot. Deeper hierarchies make navigation and policy management cumbersome.

3. Use Consistent Naming

Establish a naming convention and enforce it. OCIFinOps groups costs by compartment name, so consistency matters. We recommend: {team}-{environment} or {business-unit}-{project}-{environment}.

4. Assign Budget Owners

Every compartment should have an owner who is accountable for its costs. OCIFinOps makes this easy by showing cost trends per compartment, making it clear when a team is trending over budget.

5. Handle Shared Costs

Some costs (networking, security, monitoring) don't belong to a single team. Create a dedicated Shared-Services compartment and use a fair allocation model — such as proportional split based on each team's compute usage.

Connecting to OCIFinOps

Once your compartment strategy is in place, OCIFinOps automatically picks up the hierarchy from your cost reports. You can explore costs by compartment, set up anomaly detection per compartment, and even ask natural language questions like "Which compartment spent the most on compute this month?"

A good compartment strategy is a one-time investment that pays dividends in every cost conversation going forward.

Ready to optimize your OCI costs?

Start with a free demo and see how OCIFinOps can help.