Oracle Cloud Infrastructure (OCI) has a special feature called Compartments. Compartments help you organize your cloud resources, control who can use them, and keep them separate. This makes managing your cloud account easier and safer.
What Is a Compartment?
When you create an OCI account, you get a tenancy (another name for your account). Each tenancy comes with a Root Compartment, which can hold all of your cloud resources. You can put everything in the Root Compartment, but it is better to create separate compartments for different resources.
For example:
A Network Compartment for networks like Virtual Cloud Networks (VCNs)
A Storage Compartment for storage resources like block storage and databases
This helps keep resources isolated and allows you to control who can use them.
How Compartments Work
One Compartment per Resource
- Each resource belongs to one compartment. For example, a virtual machine in Compartment A cannot be in Compartment B unless you move it.
Control Access
- You can create users and groups, and write policies to decide who can use the resources in a compartment. For example, only storage admins can use the storage compartment.
Resources Can Work Together
– Resources in different compartments can still interact. For example, a compute instance in one compartment can use a network in another compartment. This keeps your design flexible and clean.
Extra Features of Compartments
Move Resources – You can move a resource from one compartment to another if needed.
Global Access
– Compartments exist across all regions in your tenancy. For example, a compartment created in Phoenix also appears in Ashburn. You can control access for specific regions using policies.
Nested Compartments
– Compartments can be nested up to six levels, helping you organize resources like your company or team structure.
Quotas and Budgets
– You can set quotas to limit what resources can be created, like blocking bare metal or Exadata. You can also set budgets to get notifications if spending in a compartment goes over a set amount.
Why Use Compartments?
Compartments help you:
Organize resources by type, team, or project
Control access so only the right users can use certain resources
Manage multi-region deployments easily
Track costs and usage with budgets and quotas
Follow your company structure using nested compartments
Using compartments this way keeps your OCI tenancy organized, safe, and easy to manage.
Conclusion:
OCI Compartments are a powerful tool to organize, separate, and control your cloud resources. By using compartments, you can manage your cloud account better, keep resources secure, and match your organization’s structure.