GitHub Repository: https://github.com/timmcfadden/OCI-SmartDelete

Quick Start: Clone the repo and run ./setup.sh (Mac/Linux) or setup.bat (Windows)


OCI Smart Delete Screenshot

Cleaning up Oracle Cloud Infrastructure compartments has traditionally been a slow, tedious process. Traditional tools scan through 60+ empty resource types sequentially, taking 3-5 minutes just for discovery. OCI Smart Delete changes everything with a search-first approach that completes discovery in 1-2 seconds.

Why OCI Smart Delete?

Speed & Efficiency

  • Discovery in 1-2 seconds - compared to 3-5 minutes for traditional tools
  • Uses OCI Search service to identify existing resources
  • Only processes resource types actually present in compartments
  • Eliminates redundant API calls

Comprehensive Coverage

Supports 124 resource types across all major OCI services:

  • Compute (instances, boot volumes, custom images)
  • Networking (VCNs, subnets, load balancers, VPN)
  • Database (ADB, MySQL, NoSQL, PostgreSQL)
  • Storage (object storage, file storage, block volumes)
  • Containers (OKE clusters, container instances)
  • Functions and API Gateway
  • Monitoring, logging, and notifications
  • Security (vaults, keys, secrets, bastion)
  • And many more...

Smart Capabilities

  • Automatic dependency-aware deletion ordering - handles resource dependencies intelligently
  • Intelligent retry logic with exponential backoff
  • Handles rate limiting and temporary conflicts automatically
  • Parallel processing within resource types for maximum speed

Getting Started

Requirements

  • Python 3.7+
  • OCI Python SDK
  • Flask (for web interface)
  • Valid OCI credentials via CLI config or environment variables

Installation

Clone the repository and run the setup script:

Mac/Linux:

git clone https://github.com/timmcfadden/OCI-SmartDelete.git cd OCI-SmartDelete ./setup.sh

Windows:

git clone https://github.com/timmcfadden/OCI-SmartDelete.git cd OCI-SmartDelete setup.bat

The web interface will be available at http://localhost:8080


Usage

The web interface provides a beautiful, modern UI with:

  • Visual compartment browser
  • Real-time resource discovery
  • Progress tracking with detailed status updates
  • Visual results and success/failure indicators

Simply navigate to http://localhost:8080 after running setup, select your compartment, and click delete.

Command Line Interface

For automation and scripting:

python3 oci_smart_delete.py -c <compartment_ocid>

Common Options:

# Force mode (skip confirmations) python3 oci_smart_delete.py -c ocid1.compartment.oc1..xxx --force # Specific region python3 oci_smart_delete.py -c ocid1.compartment.oc1..xxx --region us-ashburn-1 # Use specific config profile python3 oci_smart_delete.py -c ocid1.compartment.oc1..xxx --profile PRODUCTION # Debug logging python3 oci_smart_delete.py -c ocid1.compartment.oc1..xxx --debug

Architecture Advantage

Traditional compartment cleanup tools follow an iteration-based approach:

  1. List all possible resource types (60+ types)
  2. Query each type individually
  3. Most queries return empty results
  4. Takes 3-5 minutes just for discovery

OCI Smart Delete uses a revolutionary search-first approach:

  1. Query OCI Search service once
  2. Identify which resource types actually exist
  3. Only process those specific types
  4. Discovery completes in 1-2 seconds

This architectural difference means:
- 90% faster discovery
- Fewer API calls
- Lower chance of rate limiting
- Better overall performance


Real-World Use Cases

Development Environment Cleanup

Quickly clean up test compartments at the end of sprints:

python3 oci_smart_delete.py -c ocid1.compartment.oc1..devtest --force

Cost Optimization

Identify and remove unused resources during cost audits using the web interface to see exactly what exists before deletion.

Automated Teardown

Integrate into CI/CD pipelines for ephemeral environment cleanup:

python3 oci_smart_delete.py -c $TEMP_COMPARTMENT_OCID --force --region $REGION

Safety Features

  • Confirmation prompts (unless using --force)
  • Detailed logging of all operations
  • Error handling for protected resources
  • Respects OCI service limits and rate limiting
  • Automatic retry for temporary failures

Get Started Today

OCI Smart Delete is open source and available on GitHub:

Repository: https://github.com/timmcfadden/OCI-SmartDelete

Whether you're managing development environments, optimizing costs, or automating infrastructure teardown, OCI Smart Delete makes compartment cleanup fast, easy, and reliable.

Try it today and experience the difference of search-first resource discovery! 🚀