TheKoguryo's Tech Blog

 Version 2024-11-29

Warning

This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.

6.1 Compartment

A compartment is a logical concept that makes it easy to manage resources, and you can think of it as a folder structure. When a Tenancy is created, one Root Compartment is created for the first time, and an administrator can add a new Compartment as a child of the Root Compartment. All OCI resources belong to a specific compartment, and users’ access policies can be managed in units of compartments.

When the first Tenancy is created, the Root Compartment is created and can contain all Cloud resources. Think of it as the root folder.

There are many things to consider before configuring Compartment within Tenancy, but consider the following.

  • When creating a resource (eg Instance, Block Storage Volume, VCN, Subnet), the compartment to contain the resource must be specified.
  • Once a resource is created, it cannot be moved to another compartment.
  • To delete a compartment, all resources belonging to the compartment must be deleted or terminated.
  • Permissions for the entire tenancy can be granted to a user group, and can also be granted in units of compartments.

Compartment configuration example

The OCI documentation guide mainly cites the following two methods as examples. Refer to this when composing the compartment.

Example #1, just use one

If Tenancy is used by a small organization, only use the first created Root Compartment. However, in consideration of functional testing, the Oracle documentation describes a method of creating at least one sandbox compartment and then granting many privileges to the sandbox to the general user group, but to grant strict and detailed privileges to the root compartment as an example. holding it.

Compartment configuration considering example #2, department, project, etc.

In addition to the Root Compartment and Sandbox Compartment, the example shows how to configure the Compartment in consideration of each department and project and grant detailed rights to each Compartment.

Create a Sandbox Compartment

You can create a Compartment through the following process: If it has already been created in the previous chapter, it is omitted.

  1. Open the navigation menu in the OCI console. Go to Identity & Security > Identity > Compartments.
  2. Click Create Compartment
  3. Enter creation information
    • Name: Enter “Sandbox”
    • Description: Enter a description, eg, “Sandbox” as the name
    • Parent Compartment: Designate Parent Compartment, select Root Compartment
  4. Click Create Compartment

Create Production Compartment

  1. Create an extra Compartment named Production for testing.
  2. Create a compartment with the following information
    • Name: Enter “Production”
    • Description: Enter a description, eg “Production” as the name
    • Parent Compartment: Designate Parent Compartment, select Root Compartment


As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.

Last updated on 12 Jan 2019