Skip to main content
Instance Discovery

OCI Stopped InstancesLister

Professional Python script that discovers and analyzes stopped compute instances across Oracle Cloud Infrastructure. Fast parallel processing with comprehensive CSV + HTML reporting for resource optimization.

Quick Start
# List all stopped instances
python stopped_instances.py
# Filter by age (30+ days)
python stopped_instances.py --min-days 30
# Specific compartments
python stopped_instances.py --compartments ocid1.comp...

Stopped instance audit quick start

Structured quick-reference sections for prerequisites, installation, usage, and troubleshooting.

Prerequisites

  • Python 3.x environment with OCI SDK and report dependencies installed
  • OCI CLI/configured credentials (or equivalent API key config) for target tenancy
  • Read access to compartments, compute instance metadata, and related resource inventory
  • Local filesystem access for CSV + HTML reports

Common parameters

ParameterPurposeExample
--min-daysFilters stopped instances by age30
--compartmentsTargets specific OCI compartmentsocid1.compartment...
--regionsLimits scanning to selected regionsus-phoenix-1,us-ashburn-1
--max-workersControls parallelism for large tenancies10

Use compartment scoping and worker limits first when validating large OCI estates.

Standard run path

  1. 1Run a tenancy-wide discovery to understand the baseline count of stopped OCI instances.
  2. 2Apply `--min-days 30` to focus on likely abandoned instances.
  3. 3Use `--compartments` and/or `--regions` to validate results for specific teams or environments.
  4. 4Review attached boot volumes and owner tags before cleanup decisions.
bash
python stopped_instances.py
bash
python stopped_instances.py --min-days 30
bash
python stopped_instances.py --compartments ocid1.compartment... --min-days 30 --max-workers 10

Outputs and prioritization

CSV + HTML report set

Field / signalWhat it tells youFollow-up action
Instance ageHow long the instance has been stoppedPrioritize long-idle instances
Compartment / regionOrganizational ownership contextRoute review to compartment owners
Owner tagsLikely responsible team/personValidate intent before cleanup
Volume/storage contextPotential ongoing cost despite stopped stateAssess boot/block volume cleanup
  • HTML output is useful for review meetings; CSV output is better for bulk triage and dashboards.

Troubleshooting

  • If authentication fails, verify your OCI config profile, API key, and tenancy/user OCIDs.
  • If some compartments are missing, confirm compartment-level permissions and inherited policies.
  • If scans are slow or time out in large tenancies, reduce `--max-workers` and split runs by region/compartment.

Cost follow-through

Stopped compute instances may still leave billable boot/block volumes behind. Validate attached storage before declaring savings complete.

Blaze
Blaze says:Use --min-days 30 as your starting filter. Instances stopped for a month are almost never coming back -- and their boot volumes are still costing you money every single day.

Simple & Fast Instance Discovery

Comprehensive analysis and reporting for stopped OCI compute instances with enterprise-grade performance

Parallel Processing

High-performance parallel scanning across regions and compartments with configurable worker threads

Multi-Region Discovery

Automatically discovers all subscribed regions or targets specific regions for focused analysis

Compartment Intelligence

Smart compartment discovery with caching and support for specific compartment targeting

Owner Detection

Extracts owner information from both freeform and defined tags for accountability tracking

Age Analysis

Calculates days since instance creation with intelligent date parsing and timezone handling

Dual Report Formats

Generates both CSV (for analysis) and HTML (for executive reporting) with comprehensive breakdowns

Robust Error Handling

Comprehensive retry logic, timeout handling, and graceful failure recovery for production environments

Performance Tracking

Real-time progress tracking with performance metrics and API call monitoring

Usage Examples

Real-world scenarios for OCI instance lifecycle management and optimization

Complete Tenancy Scan

python stopped_instances.py

Discovers all stopped instances across your entire OCI tenancy with automatic region and compartment discovery.

Age-Based Filtering

python stopped_instances.py --min-days 30

Focuses on instances stopped for 30+ days for lifecycle management and potential cleanup decisions.

Targeted Compartment Analysis

python stopped_instances.py --compartments ocid1.comp.oc1..xxx,ocid1.comp.oc1..yyy

Analyzes specific compartments for focused resource management and compliance reporting.

Regional Scope Control

python stopped_instances.py --regions us-ashburn-1,us-phoenix-1

Limits analysis to specific regions for targeted optimization and reduced API calls.

Technical Specifications

Enterprise-grade Python script with comprehensive OCI instance discovery capabilities

Requirements

Python 3.6+

Modern Python with asyncio and concurrent.futures support

OCI Python SDK

Oracle Cloud Infrastructure SDK for Python (pip install oci)

OCI Configuration

Valid OCI config file (~/.oci/config) with appropriate authentication

IAM Permissions

Read access to compute instances and compartments across target regions

Network Connectivity

Internet access to OCI API endpoints with configurable timeouts

Command Line Options

--min-days

Minimum days since creation filter (default: 0)

--compartments

Comma-separated compartment OCIDs for targeted analysis

--regions

Comma-separated region names to scan

--profile

OCI config profile to use (default: DEFAULT)

--max-workers

Maximum parallel workers (default: 20)

Core Features

Discovery Engine

  • • Automatic region and compartment discovery
  • • Parallel processing with configurable worker threads
  • • Intelligent caching for performance optimization
  • • Retry logic with exponential backoff

Data Processing

  • • Instance age calculation with timezone handling
  • • Owner extraction from freeform and defined tags
  • • Shape, region, and availability domain analysis
  • • Configurable age-based filtering

Reporting Capabilities

  • • CSV export for data analysis and integration
  • • Rich HTML reports with visual breakdowns
  • • Age distribution analysis with priority levels
  • • Regional and compartment distribution charts

Performance Optimization

  • • Concurrent API calls with rate limiting
  • • Progress tracking and performance metrics
  • • Configurable timeouts and retry strategies
  • • Memory-efficient data processing

Comprehensive Reporting

Professional reporting in multiple formats with detailed analytics and visual breakdowns

CSV Data Export

Structured CSV export optimized for data analysis, filtering, and integration with business intelligence tools.

Instance details and configuration
Age analysis and creation timestamps
Owner information from tag analysis
Regional and compartment organization
Shape and availability domain details

HTML Executive Report

Rich HTML report with visual analytics, age distribution charts, and executive-friendly presentation for stakeholder communication.

Executive summary with key metrics
Age distribution with priority levels
Regional and compartment breakdowns
Top oldest instances analysis
Performance metrics and API statistics

Chef's Tips & Best Practices

Professional recommendations for effective OCI instance lifecycle management

Performance Tuning

Start with 10-15 workers for large tenancies to balance speed and API rate limits. Like preparing multiple dishes simultaneously, find the right balance for your kitchen capacity.

Regional Strategy

Use region filtering for focused analysis or to avoid regions with connectivity issues. Target specific regions like a chef selecting the best ingredients from trusted suppliers.

Age-Based Filtering

Start with 30+ day filters for initial cleanup identification. Like aging wine, some instances need time, but others may be forgotten and ready for cleanup.

Owner Engagement

Use the owner detection to reach out before cleanup decisions. The script identifies owners through tags, enabling proactive communication about instance lifecycle.

Security Considerations

Ensure proper IAM permissions and use appropriate OCI profiles for different environments. The script respects OCI security boundaries and will only analyze accessible resources.

Report Integration

Import CSV reports into analytics tools for trend analysis. The structured output enables executive dashboards and automated lifecycle management workflows.

Ready to Optimize Your OCI Resources?

Download the OCI Stopped Instances Lister and start identifying optimization opportunities in your Oracle Cloud Infrastructure today. Simple, fast, and comprehensive instance discovery.

What to do next

Pick the path that fits where you are right now.

Trust & run-safety metadata

Key execution details for OCI Stopped Instances Detective so users know what they are downloading or running before they act.

Need verification guidance? See Security & Trust and Responsible Disclosure.

Read-only / reportingGitHub sourceExplicit + inferred metadata

Maintainer

CloudCostChefs

Last Updated

July 4, 2025

Last Tested

February 23, 2026

Minimum Access

Read-only OCI Compute + Identity access to the compartments included in the scan

Execution Type

GitHub-hosted Python reporting script (OCI stopped instance inventory)

Version

2025-07-04

SHA256 Checksum

Not published yet (recommend adding checksum for downloadable files)

Verification Notes

GitHub-hosted OCI reporting script. Review OCI authentication mode, compartment scope, and output paths before running scheduled reports.

Safe Usage Checklist

  • Confirm stopped instances are not intentionally reserved for DR or maintenance before cleanup recommendations.
  • Protect exported CSV/HTML outputs if they include resource names, tags, or owner metadata.
  • Run in a non-production subscription/account/tenancy first and capture sample output before broader rollout.
  • Use least-privilege access. Current best hint from docs: Read-only OCI Compute + Identity access to the compartments included in the scan.

Quick start (fast path)

Minimal steps to safely get value from this tool without reading the entire page first.

Estimated time: 5-10 minutes per tenancyDifficulty: IntermediateAccess: Review / read-only
  1. 1. Confirm scope and permissions

    Use least privilege and test in a non-production scope first. Minimum access hint: Read-only OCI Compute + Identity access to the compartments included in the scan.

  2. 2. Get the tool package / source

    View on GitHub and review the files before running.

    GitHub
  3. 3. Check prerequisites

    • ✅ Python 3.6+ with concurrent.futures and asyncio support
    • ✅ OCI Python SDK installed (pip install oci) with proper configuration
    • ✅ Valid OCI config file (~/.oci/config) with appropriate authentication setup
  4. 4. Run safely and review output

    GitHub-hosted OCI reporting script. Review OCI authentication mode, compartment scope, and output paths before running scheduled reports. Start with a small sample scope, then expand once results look correct.