What Is an OCI Compartment? Design Tenancy and Resource Access Boundaries
Understand how OCI tenancies, compartments, and IAM policies organize resources, inherit access, and support cost allocation.
In Oracle Cloud Infrastructure (OCI), a tenancy is the top-level boundary for cloud resources; a compartment is a logical container for grouping resources and scoping access. The tenancy is also called the root compartment, and child compartments can be nested. When creating a resource, you select its compartment; IAM policies determine which groups can perform which actions there. A compartment is not a physical location: it is a boundary for permissions, delegated administration, and usage or cost organization.
Tenancy, compartments, and resources
Oracle creates a tenancy when you subscribe to OCI. It contains IAM objects such as users, groups, compartments, and some policies. Workload resources such as compute instances, virtual cloud networks (VCNs), and block volumes are placed in compartments. Compartments are logical rather than physical and are available across the tenancy’s subscribed regions; each service resource’s region is selected separately.
Policy inheritance and access
OCI IAM policies state which group can perform which actions on which resource types and at what scope. Child compartments inherit policies from parents. A policy at the tenancy level can reach resources throughout the tenancy; a parent-compartment policy can affect nested compartments too. This reduces repeated grants, but may create broader access than expected.
Creating a compartment does not automatically grant ordinary users access. Administrators or groups with permissions inherited from a parent may still have access. Where a policy is attached also affects who can later modify or delete it, so design both its statement and attachment location.
Choosing boundaries
Use compartments where access, delegated ownership, governance, or cost reporting genuinely differs. For example, separate development from production, or place shared networking resources in a network compartment managed by a platform team. Give each workload team access only to its resources and needed shared resources.
Avoid making a compartment for every service without a reason. Excessive fragmentation makes policies and cost structures harder to understand. Ask who needs access, who administers policies, and how usage should be reported. When products share resources across compartments, compartment-only cost reporting may not attribute all costs accurately; Oracle recommends using resource tags for more flexible analysis.
Review moves before making them
Moving a compartment changes its parent. Policies from the destination parent can take effect while policies from the former parent may stop applying. Some statements attached to a shared ancestor can update automatically, but not all policies do. Review which groups will lose or gain access.
A move may not be blocked even when the destination quota would be exceeded. Afterwards, new resource creation might be prevented until quotas are adjusted or resources removed. If tag defaults depend on the old hierarchy, review tags too. Include access, policy attachment, quotas, tags, and cost reporting in the change review.
Hypothetical example: Two product teams share a VCN but must keep their compute and storage separate. Put the VCN in a Networks compartment managed by network administrators, and workloads in Product-A and Product-B compartments. Give each team only the permissions needed in its own compartment and separate permission to use the shared network. This illustrates a design, not a tested deployment. Check current OCI IAM policy syntax for your identity-domain configuration before implementing statements.
Design sequence
Identify the tenancy and tightly control groups with tenancy-wide administration.
Map real access, ownership, governance, and cost-reporting boundaries.
Design the compartment tree before placing workload resources.
Grant least privilege at the narrowest useful scope.
Review parent policy inheritance and where each policy is attached.
Before moving a compartment, check access changes, quotas, tags, and cost reports.
A good OCI compartment design makes policies easier to understand and administration safer to delegate. Use the tenancy as the root security boundary, compartments as logical resource and access boundaries, and verify inheritance before placing or moving workloads.
Sources
[OCI IAM overview](https://docs.oracle.com/en-us/iaas/Content/Identity/Concepts/overview.htm)
[Working with compartments](https://docs.oracle.com/en-us/iaas/Content/Identity/compartments/Working_with_Compartments.htm)
[Policy inheritance](https://docs.oracle.com/en-us/iaas/Content/Identity/policieshow/Policy_Inheritance.htm)
[Policy locations](https://docs.oracle.com/en-us/iaas/Content/Identity/policysyntax/location.htm)
[Tenancy and compartment design](https://docs.oracle.com/en/cloud/foundation/cloud_architecture/identity/tenancyusers.html)
[Track usage and cost](https://docs.oracle.com/en/solutions/oci-best-practices/track-and-manage-usage-and-cost1.html)