Home / OCI

OCIChecklistBeginner

OCI cost and governance foundation: tag namespaces, defaults, budgets and quotas

Create defined tag namespaces with tag defaults per compartment, set budgets with forecast alerts, use quotas to cap spend, and review cost reports monthly.

Deepak Bhardwaj2 min read

Applies toOCI Tagging, Budgets, Compartment Quotas, Cost Analysis, Cost and Usage Reports

1. Defined tags (not free-form)

oci iam tag-namespace create --compartment-id <tenancy-ocid> --name Ops --description "Operations tags"
oci iam tag create --tag-namespace-id <ns-ocid> --name CostCenter --description "Chargeback" --is-cost-tracking true
oci iam tag create --tag-namespace-id <ns-ocid> --name Environment --description "prod/dr/test/dev" \
  --validator '{"validatorType":"ENUM","values":["prod","dr","test","dev"]}'
oci iam tag create --tag-namespace-id <ns-ocid> --name Owner --description "Owning team"
oci iam tag create --tag-namespace-id <ns-ocid> --name DRTier --description "tier1/tier2/none"
  • Mark cost-relevant tags as cost-tracking (they appear in Cost Analysis and budgets).
  • Use enum validators so values stay consistent.

2. Tag defaults per compartment

Set Ops.Environment = prod as a required tag default on cmp-payments-prod: every resource created there gets it, and users can't create resources without it.

3. Budgets

oci budgets budget create --compartment-id <tenancy-ocid> --target-type COMPARTMENT \
  --targets '["<cmp-payments-prod-ocid>"]' --amount 5000 --reset-period MONTHLY \
  --display-name payments-prod-monthly
oci budgets alert-rule create --budget-id <budget-ocid> --type FORECAST --threshold 80 \
  --threshold-type PERCENTAGE --recipients "finops@contoso.com"

Budgets can also target a cost-tracking tag (for example all Ops.Environment = dr).

4. Quotas as a cost guardrail

zero compute-core quotas in compartment cmp-sandbox
set compute-core quota standard-e5-core-count to 16 in compartment cmp-sandbox

Quota names differ per service and shape. List them before writing statements:

oci limits definition list --compartment-id <tenancy-ocid> --service-name compute --all \
  --query "data[].name" --output table

Quotas stop the "someone launched a bare metal GPU shape in the sandbox" problem before it costs anything.

5. Monthly review

  • Cost Analysis grouped by compartment and by CostCenter tag
  • Stopped instances still paying for boot volumes, and unattached block volumes
  • Autonomous Database auto scaling usage vs base OCPU/ECPU
  • Object Storage tiers (Infrequent Access, Archive) and lifecycle policies
  • Universal Credits / commitments consumption vs plan
oci bv volume list --compartment-id <cmp> --lifecycle-state AVAILABLE --query "data[].{name:\"display-name\",size:\"size-in-gbs\"}" --output table

(Check attachments with oci compute volume-attachment list to find the unattached ones.)

6. Cost and Usage Reports

Daily CSV reports in an Oracle-owned bucket you can read (with a cross-tenancy policy) or export via Connector Hub. Load them into your BI tool for chargeback.