Lab: 30 Tags - TanveeKhanDB/OCI GitHub Wiki

Tags in OCI:

Tagging in OCI is a metadata system that allows you to organize, categorize, and manage cloud resources through key-value pairs. Think of it as labeling your infrastructure for better governance, cost tracking, and operational management.

Concept of Tagging in OCI

A tag = key + value pair

Environment: Production

Owner: DevOpsTeam

Project: BankingApp

Relation of Namespace, Keys and values:

Usage

Tagging serves several critical purposes:

  • Cost Allocation: Track spending by department, project, or environment
  • Resource Organization: Logically group related resources across regions
  • Access Control: Enforce policies based on tags (tag-based policies)
  • Automation: Trigger automated workflows based on tag values
  • Lifecycle Management: Identify and manage resource retention policies
  • Compliance & Audit: Maintain governance and audit trails

Type of Tag

There are mainly three types of tag

Defined Tag → Company standard label

Free-form Tag → Easy custom label

System Tag → OCI automatic label

1. Defined Tags

  • Created and managed by administrators.
  • Structured and standardized.
  • More secure and recommended for enterprises.

Example

Operations.CostCenter = Finance

Best For Governance Billing Enterprise standards

2. Free-form Tags

  • Simple custom key-value tags.
  • No predefined structure.
  • Easy and flexible.

Example

Project = HRApp

Best For

  • Small teams
  • Temporary usage
  • Quick tagging

3. System Tags

  • Automatically created by OCI.
  • Used internally by OCI services.

Example

CreatedBy = [email protected]

Best For

  • Auditing
  • Tracking resource creator

Best Practices

  • Establish a tagging strategy before deploying resources
  • Use defined tags for mandatory enterprise requirements
  • Combine both types - use freeform for flexibility, defined for compliance
  • Apply tags at resource creation to avoid gaps
  • Review tags regularly to maintain consistency
  • This dual-tag approach gives you the flexibility and control needed in large-scale cloud operations.

Steps to create Tag in OCI.

Always create Tag to the upper level (Root) so that its child can also use this.

Namespace should be same or matching to Oragnization not application level.

Assigning Keys and values to specific tag namespace.



Assinging tag while creating Block volume in OCI.


Demo of tag attachment under custom RT: