Skip to content

61. Tags

Ayushi-srivastav edited this page Jul 29, 2026 · 6 revisions

What do you mean by Tags in OCI

Tags in OCI are metadata labels applied to cloud resources such as virtual machines, databases, storage buckets, and networks. Each tag consists of a tag namespace, a key, and a value, allowing you to group and classify resources according to your organization's needs.

  • Tag Namespace: A container for a set of tags ensuring name uniqueness across OCI. For example, Operations or Finance.
  • Tag Key: The attribute name you want to assign to a resource, like Environment or Project.
  • Tag Value: The specific value associated with the key, such as Production,Staging,Dev and Test.

Types of Tags in OCI

  • Free-form Tags: Simple key-value pairs without strict governance, used for flexible labeling.
  • Defined Tags: Predefined key-value pairs within a tag namespace, often enforced by policies or standards to maintain consistency across your organization.

Key Differences

Feature | Free-Form Tags | Defined Tags -- | -- | -- Creation | Any user can create | Admins define namespaces, keys, and allowed values Flexibility | High, no restrictions | Restricted to pre-approved keys and values Consistency | Potentially inconsistent | Enforced consistency across tenancy Use Case | Quick, ad hoc labeling | Cost tracking, compliance, governance Governance | Minimal | High, centralized control

Best Practices

  • Use defined tags for structured reporting, billing, and governance.
  • Apply free-form tags for ad hoc or temporary categorization needs.
  • Consistently use naming conventions for tag keys and values to avoid duplication and confusion.
  • Integrate tags with identity policies for fine-grained access control. By effectively using tags, OCI users can streamline resource management, control costs, and maintain governance over their cloud environment.

Purpose and Benefits of Tags

  • Resource Organization: Tags allow you to categorize resources according to business units, projects, cost centers, or environment types, making it easier to locate and manage resources.
  • Cost Management: By tagging resources with project or department identifiers, OCI can generate cost reports and usage tracking for specific tags, which helps in budgeting and chargebacks.
  • Access Control: Tags can be integrated with OCI IAM (Identity and Access Management) policies to restrict access or perform actions on only those resources that have specific tags.
  • Automation and Governance: Tags facilitate automation scripts, resource orchestration, and compliance checks by enabling tools to identify resources based on their tags.

Steps to Tag Namespaces

Step 1- Navigate to Governance & Administration and select the option [Tag Namespaces]

image

Step 2- Select the option Create Tag Namespace We'll create the tags in root level as it's the highest level of services and from here we can assign tags to any child compartments.

image

Step 3- Fill in details and select the option create

Name:

Description:

Compartment:

Usually root compartment (tenancy) Best practice: create namespaces at tenancy level The name of the tag namespace is almost equivalent to name of the organization

image image

Difference Between Tag Namespace and Tags

Feature | Tag Namespace | Tag -- | -- | -- What it is | Container for tags | Label applied to resource Purpose | Organize tags | Identify/describe resources Level | Created at tenancy | Created inside namespace Usage | Not applied directly | Applied to resources Analogy | Folder | File inside folder

🔸 Example:

Namespace: Environment
   ├── Tag Key: Env
   │       Value: Prod / Dev / Test
   ├── Tag Key: Owner
           Value: Ayushi

Steps to Create Tags Step 1- Go inside the Tag Namespace and select the option create Tag Key Definition

image

Step 2- Fill the required details:

  • Name (Tag Key)
  • Description *Enable the cost tracking option

Tag Value Type

🔹 1. Static Value

✅ Definition: A Static Value means the tag has a fixed value, which is automatically assigned and cannot be changed by users.

🔸 Key Points:

  • Value is predefined and locked
  • Users don’t enter anything
  • Ensures strict standardization
  • Useful for governance and automation

🔹 2. A List of Values

✅ Definition: A List of Values allows users to select one value from a predefined list.

🔸 Key Points:

  • Controlled but flexible
  • Users choose from allowed options only
  • Prevents typos & inconsistencies
  • Most commonly used option

📊 Static vs List of Values

Feature | Static Value | List of Values -- | -- | -- User Input Required | ❌ No | ✅ Yes (choose from list) Flexibility | ❌ Fixed | ✅ Controlled flexibility Standardization | ✅ Very high | ✅ High Best For | Fixed attributes | Categorization fields

🧠 Simple Analogy

Static Value → Like a stamp

|
| Always same value
|

List of Values → Like a dropdown menu

|
| Pick one option
|

✅ Which One Should You Use?

Scenario | Recommended Type -- | -- You want strict control | Static Value You want controlled flexibility | List of Values Cost tracking | List of Values Automation flags | Static Value
image

Step 3- Let's create one more tag

image

Step 4- Now let's try to attach tag to our services

image

Clone this wiki locally