Skip to main content
OCICost Optimizationintermediate

OCI Cost Optimization Strategies

Reduce OCI spending with universal credits, reserved capacity, autoscaling, and cost analysis tools.

CloudToolStack Team18 min readPublished Mar 14, 2026

Prerequisites

  • Active OCI tenancy with running workloads
  • Access to OCI Cost Analysis and Budgets

Cost Optimization on Oracle Cloud Infrastructure

OCI was designed with cost-competitive pricing as a core principle. Oracle undercuts AWS, Azure, and GCP on many services, particularly compute, networking (10 TB/month free outbound data transfer), and database workloads. However, cost optimization still matters because unmanaged cloud spending can grow quickly, even on the most cost-effective platform. The key is to combine OCI's structural pricing advantages with smart resource management and governance practices.

This guide covers OCI's pricing models, Universal Credits, cost analysis tools, budgets and alerts, right-sizing strategies, autoscaling, storage optimization, and organizational governance patterns that keep your cloud spending efficient as your usage grows.

OCI Pricing Advantages

OCI offers several structural pricing advantages over other clouds: 10 TB/month free outbound data transfer (vs. 100 GB on AWS/Azure), no cost for the Kubernetes control plane, OCPU pricing that maps to physical cores (1 OCPU = 2 vCPUs), off-box networking with no performance variability, and an Always Free tier that never expires. These advantages mean that many workloads cost 30-60% less on OCI compared to other clouds before any optimization effort.

Understanding OCI Pricing Models

OCI offers two primary pricing models: Pay As You Go (PAYG) and Universal Credits. Understanding the difference is essential for forecasting and controlling costs.

Pay As You Go vs Universal Credits

FeaturePay As You GoUniversal Credits
CommitmentNone, no minimum spendAnnual commitment ($1K-$10M+/year)
DiscountList priceUp to 60% off list price
FlexibilityUse any service, any timeCredits apply to any OCI service
BillingMonthly based on usageCredits drawn down monthly
Unused creditsN/AExpire at end of commitment term
Best forTesting, small workloads, unpredictable usageProduction workloads, predictable spend
SupportMust purchase separatelyIncluded (Premier Support)

Universal Credits Are Flexible

Unlike AWS Reserved Instances or Azure Reserved VMs that commit you to specific instance types and regions, OCI Universal Credits are truly universal: they can be applied to any OCI service in any region. If your workload changes, your credits still apply. This flexibility makes Universal Credits lower risk than reserved capacity commitments on other clouds. The minimum annual commitment is typically $1,000, making it accessible even for small teams.

Cost Analysis and Visibility

OCI provides Cost Analysis, a built-in tool for understanding your spending patterns. Cost Analysis lets you filter and group costs by service, compartment, tag, region, and resource, with daily or monthly granularity. You can create custom reports, save frequently-used queries, and export data for external analysis.

bash
# View current month's costs by service
oci usage-api usage-summary request-summarized-usages \
  --tenant-id <tenancy-ocid> \
  --time-usage-started "2026-03-01T00:00:00Z" \
  --time-usage-ended "2026-03-14T23:59:59Z" \
  --granularity "MONTHLY" \
  --group-by '["service"]' \
  --query-type "COST" \
  --query 'data.items[].{service:"service", cost:"computed-amount", currency:"currency", unit:"unit"}' \
  --output table

# View costs by compartment
oci usage-api usage-summary request-summarized-usages \
  --tenant-id <tenancy-ocid> \
  --time-usage-started "2026-03-01T00:00:00Z" \
  --time-usage-ended "2026-03-14T23:59:59Z" \
  --granularity "MONTHLY" \
  --group-by '["compartmentPath"]' \
  --query-type "COST"

# View daily cost trend
oci usage-api usage-summary request-summarized-usages \
  --tenant-id <tenancy-ocid> \
  --time-usage-started "2026-02-01T00:00:00Z" \
  --time-usage-ended "2026-03-14T23:59:59Z" \
  --granularity "DAILY" \
  --query-type "COST" \
  --query 'data.items[].{date:"time-usage-started", cost:"computed-amount"}' \
  --output table

# View costs by tag (requires defined tags with cost tracking enabled)
oci usage-api usage-summary request-summarized-usages \
  --tenant-id <tenancy-ocid> \
  --time-usage-started "2026-03-01T00:00:00Z" \
  --time-usage-ended "2026-03-14T23:59:59Z" \
  --granularity "MONTHLY" \
  --group-by '["tag:project-tags.Environment"]' \
  --query-type "COST"

Budgets and Alerts

OCI Budgets let you set spending limits and receive alerts when actual or forecasted spending approaches or exceeds your budget. You can create budgets at the compartment level (to track team or project spending) or at the tenancy level (for overall cost governance). Alerts can be configured to trigger at multiple thresholds.

bash
# Create a monthly budget for a compartment
oci budgets budget create \
  --compartment-id <tenancy-ocid> \
  --amount 1000 \
  --reset-period "MONTHLY" \
  --display-name "production-budget" \
  --description "Monthly budget for production compartment" \
  --target-type "COMPARTMENT" \
  --targets '["<production-compartment-ocid>"]'

# Create an alert rule (alert at 80% of budget)
oci budgets alert-rule create \
  --budget-id <budget-ocid> \
  --type "ACTUAL" \
  --threshold 80 \
  --threshold-type "PERCENTAGE" \
  --display-name "80-percent-alert" \
  --recipients "admin@example.com"

# Create a forecast alert (alert when forecasted to exceed budget)
oci budgets alert-rule create \
  --budget-id <budget-ocid> \
  --type "FORECAST" \
  --threshold 100 \
  --threshold-type "PERCENTAGE" \
  --display-name "forecast-exceed-alert" \
  --recipients "admin@example.com"

# List budgets
oci budgets budget list \
  --compartment-id <tenancy-ocid> \
  --query 'data[].{name:"display-name", amount:amount, spent:"actual-spend", forecast:"forecasted-spend"}' \
  --output table

Budgets Do Not Stop Spending

OCI budgets are for alerting purposes only. They do not automatically stop or throttle resource usage when the budget is exceeded. To enforce hard spending limits, combine budgets with IAM policies that restrict resource creation in specific compartments, quota policies that cap the number of resources, and regular review of cost analysis reports. Consider using OCI Functions to create automated remediation actions triggered by budget alerts through the Notifications service.

Compute Cost Optimization

Compute is typically the largest cost category in any cloud deployment. OCI provides several mechanisms to optimize compute costs without sacrificing performance.

Optimization Strategies

StrategySavingsEffortImpact
Right-size with flex shapes20-50%LowEliminate waste from fixed-size instances
Use ARM (Ampere A1)~50%MediumBest price-performance for compatible workloads
Preemptible instances~50%MediumGreat for fault-tolerant batch workloads
Stop idle instancesUp to 100%LowDev/test instances not needed 24/7
Autoscaling30-60%MediumMatch capacity to demand dynamically
Always Free tier100%None2 AMD + 4 ARM cores for free forever
bash
# Find underutilized instances (low CPU over 7 days)
oci monitoring metric-data summarize-metrics-data \
  --compartment-id $C \
  --namespace "oci_computeagent" \
  --query-text 'CpuUtilization[7d].mean() < 10'

# Schedule instance stop/start for dev environments
# Create an OCI Function that stops instances tagged "environment=dev"
# Trigger it via a scheduled alarm or OCI Events

# Example: Stop all dev instances in a compartment
oci compute instance list \
  --compartment-id $C \
  --lifecycle-state RUNNING \
  --query 'data[?"freeform-tags".Environment == `dev`].id' \
  --raw-output | while read INSTANCE_ID; do
    echo "Stopping: $INSTANCE_ID"
    oci compute instance action --instance-id "$INSTANCE_ID" --action STOP
done

# Right-size: reduce OCPU and memory on an underutilized flex instance
oci compute instance update \
  --instance-id <instance-ocid> \
  --shape-config '{"ocpus": 1, "memoryInGBs": 8}'

# Check instance pool size for autoscaling opportunities
oci compute-management instance-pool list \
  --compartment-id $C \
  --query 'data[].{name:"display-name", size:size, state:"lifecycle-state"}' \
  --output table

Storage Cost Optimization

Storage costs accumulate silently as data grows. Implementing tiered storage, lifecycle policies, and regular cleanup of unused volumes prevents storage from becoming a significant cost driver.

bash
# Find unattached block volumes (paying for storage not being used)
oci bv volume list \
  --compartment-id $C \
  --lifecycle-state AVAILABLE \
  --query 'data[?!("is-auto-tune-enabled")].{name:"display-name", "size-gb":"size-in-gbs", created:"time-created", id:id}' \
  --output table

# Find old boot volume backups that can be cleaned up
oci bv boot-volume-backup list \
  --compartment-id $C \
  --query 'data[].{name:"display-name", "size-gb":"size-in-gbs", created:"time-created", type:type}' \
  --output table

# Enable auto-tiering on object storage buckets
oci os bucket update \
  --namespace $NAMESPACE \
  --bucket-name "application-data" \
  --auto-tiering "InfrequentAccess"

# Check bucket sizes
oci os bucket get \
  --namespace $NAMESPACE \
  --bucket-name "application-data" \
  --query 'data.{"approximate-size": "approximate-size", "approximate-count": "approximate-count"}'

# Reduce block volume performance tier to save costs
# Lower Cost tier (0 VPUs/GB) vs Balanced (10 VPUs/GB)
oci bv volume update \
  --volume-id <volume-ocid> \
  --vpus-per-gb 0  # Lower Cost tier for infrequently accessed data

Network Cost Optimization

OCI's networking pricing is one of its strongest competitive advantages. The first 10 TB of outbound data transfer per month is free, which is 100x more than AWS or Azure. However, there are still ways to optimize networking costs further.

Traffic TypeCostOptimization
Intra-VCN (same AD)FreeNo optimization needed
Intra-VCN (different AD)FreeNo optimization needed
Inter-VCN (same region, via DRG)FreeUse DRG instead of peering through internet
Inter-region (via DRG)Charged per GBMinimize cross-region replication; use local caches
Outbound internetFirst 10 TB/month freeUsually no action needed for most workloads
Service GatewayFreeAlways use SGW for OCI service access from private subnets
FastConnectPort fee + partner feeBundle multiple VCNs through one DRG

Service Gateway Saves Money and Improves Security

Always use a Service Gateway for accessing OCI services (Object Storage, Autonomous Database, Container Registry, etc.) from private subnets. Traffic through the Service Gateway is free, private (does not traverse the internet), and faster than going through a NAT Gateway. This is one of the simplest and most impactful cost optimizations you can make.

Database Cost Optimization

Oracle Database workloads on OCI benefit from specific optimizations related to licensing, scaling, and the unique capabilities of Autonomous Database.

bash
# Use ECPU instead of OCPU for finer-grained scaling
oci db autonomous-database update \
  --autonomous-database-id <adb-ocid> \
  --compute-model "ECPU"

# Stop Autonomous Database during non-business hours
oci db autonomous-database stop \
  --autonomous-database-id <adb-ocid>

# Enable auto-scaling (use more only when needed)
oci db autonomous-database update \
  --autonomous-database-id <adb-ocid> \
  --is-auto-scaling-enabled true

# Use the License Included model if you do not have existing Oracle licenses
# Use BYOL (Bring Your Own License) if you have unused Oracle licenses
oci db autonomous-database update \
  --autonomous-database-id <adb-ocid> \
  --license-model "BRING_YOUR_OWN_LICENSE"

# Check ADB instances and their compute allocation
oci db autonomous-database list \
  --compartment-id $C \
  --query 'data[].{name:"display-name", model:"compute-model", compute:"compute-count", storage:"data-storage-size-in-tbs", "auto-scaling":"is-auto-scaling-enabled", license:"license-model"}' \
  --output table

Quota Policies

Quota policies are a governance mechanism that limits the number of cloud resources that can be created in a compartment. Unlike budgets (which alert on spending), quotas enforce hard limits on resource creation. This prevents teams from accidentally provisioning expensive resources and ensures fair resource allocation across teams.

bash
# Create quota policies (requires administrator privileges)
# Quota policies use a specific syntax different from IAM policies

# Limit compute instances in a compartment
oci limits quota create \
  --compartment-id <tenancy-ocid> \
  --name "dev-quotas" \
  --description "Resource quotas for development compartment" \
  --statements '[
    "set compute quota vm-standard-e4-flex-core-count to 20 in compartment NonProduction:Dev",
    "set compute quota vm-standard-a1-flex-core-count to 8 in compartment NonProduction:Dev",
    "set block-storage quota total-storage-gbs to 500 in compartment NonProduction:Dev",
    "set load-balancer quota lb-flexible-count to 2 in compartment NonProduction:Dev",
    "set database quota autonomous-transaction-processing-ocpu-count to 4 in compartment NonProduction:Dev"
  ]'

# List quota policies
oci limits quota list \
  --compartment-id <tenancy-ocid> \
  --query 'data[].{name:name, statements:statements}' \
  --output json

# Check current resource usage against limits
oci limits resource-availability get \
  --service-name "compute" \
  --limit-name "vm-standard-e4-flex-core-count" \
  --compartment-id $C \
  --availability-domain $AD

Cost Optimization Checklist

CategoryActionPriority
VisibilitySet up budgets with 80% and 100% alerts for every compartmentHigh
VisibilityEnable cost-tracking tags and enforce tagging via tag defaultsHigh
ComputeRight-size all instances using flex shapes based on actual utilizationHigh
ComputeMigrate compatible workloads to ARM (Ampere A1) shapesMedium
ComputeStop dev/test instances outside business hoursMedium
ComputeUse preemptible instances for batch and CI/CD workloadsMedium
StorageDelete unattached block volumes and old backupsHigh
StorageEnable auto-tiering on all object storage bucketsMedium
StorageImplement lifecycle policies for log and backup dataMedium
NetworkUse Service Gateway for all OCI service access from private subnetsHigh
DatabaseStop non-production ADB instances outside business hoursMedium
DatabaseEnable auto-scaling on ADB instead of over-provisioningMedium
GovernanceSet quota policies for each compartment to prevent over-provisioningMedium
GovernanceReview Universal Credits commitment annually based on actual usageLow

Automating Cost Optimization

Use OCI Functions and Events to automate cost optimization tasks. For example, create a function that runs nightly to stop all dev instances, or one that sends a Slack notification when a new expensive resource is created.

bash
# Example: Use OCI CLI in a cron job to stop dev instances nightly
# Save as /opt/scripts/stop-dev-instances.sh

#!/bin/bash
COMPARTMENT_ID="ocid1.compartment.oc1..xxx"

# Get all running instances tagged as dev
INSTANCE_IDS=$(oci compute instance list \
  --compartment-id "$COMPARTMENT_ID" \
  --lifecycle-state RUNNING \
  --query 'data[?"freeform-tags".Environment == `dev`].id' \
  --raw-output)

for ID in $INSTANCE_IDS; do
  echo "$(date): Stopping instance $ID"
  oci compute instance action --instance-id "$ID" --action SOFTSTOP
done

# Add to cron: 0 20 * * 1-5 /opt/scripts/stop-dev-instances.sh
# Runs at 8 PM weekdays

# Example: Start dev instances in the morning
# 0 7 * * 1-5 /opt/scripts/start-dev-instances.sh

Track Always Free Usage

Even with Always Free resources, keep track of what you are using. If you accidentally exceed Always Free limits (e.g., creating a third AMD micro instance), you will start incurring charges. Use the OCI Console > Governance > Limits, Quotas and Usage page to view your current usage against Always Free limits. Set up budgets even for Always Free tenancies as a safety net.

OCI Compute Shapes & InstancesOCI Object Storage & TiersAutonomous Database on OCI

Key Takeaways

  1. 1Universal Credits provide a single prepaid balance that covers all OCI services.
  2. 2Reserved capacity offers up to 50% savings for predictable compute workloads.
  3. 3The Always Free tier includes compute, storage, and database resources permanently.
  4. 4OCI Cost Analysis provides granular spend tracking by compartment, tag, and service.

Frequently Asked Questions

How do OCI Universal Credits work?
Universal Credits are a prepaid commitment purchased at a discount (typically 33-60% off pay-as-you-go rates depending on the term and amount). Credits can be used for any OCI service and are consumed as you use resources. They are billed monthly based on actual consumption against the credit balance. Any overage beyond the credit amount is billed at pay-as-you-go rates.
How does OCI pricing compare to AWS and Azure?
OCI is generally 25-50% cheaper than AWS and Azure for equivalent compute and networking. Key pricing advantages include free outbound data transfer (first 10 TB/month), free control planes for OKE and load balancers, no charge for ingress traffic, and competitive OCPU pricing. OCI Ampere ARM instances are particularly cost-effective for compatible workloads.

Written by CloudToolStack Team

Cloud engineers and architects with hands-on experience across AWS, Azure, and GCP. We write guides based on real-world production patterns, not just documentation rewrites.

Disclaimer: This guide is for educational purposes. Cloud services change frequently; always refer to official documentation for the latest information. AWS, Azure, and GCP are trademarks of their respective owners.