OCI Block Volume Backup Posture Auditor

 

OCI Block Volume Backup Posture Auditor

Introduction of Python Tool That Audits OCI Block And Boot Volume Backups, Flags Stale Or Missing Backups and Generates Backup Posture Reports


Description

I built the OCI Block Volume Backup Posture Auditor as a standalone OCI automation tool to audit block volume and boot volume backup hygiene across compartments. It produces timestamped JSON + Markdown findings and uploads the artifacts to OCI Object Storage so teams can review results, share evidence and track posture over time. The tool is designed to be safe to run in production because it uses read-only OCI API calls, with the only write action being the optional Object Storage upload of the generated reports.


Codebase

GitHub Code: Click Here


Why This Is Useful

Backups are one of those controls that everyone assumes are in place until something breaks. In a real tenancy, volumes get created quickly, instances move across compartments and backup routines can drift without anyone noticing. This project gives platform and operations teams a quick way to answer, “Are my critical volumes actually protected and how stale are the latest backups?”. It is especially useful for routine operational reviews, audit readiness and catching gaps early before they become painful during incident recovery.


What The Tool Does

The auditor runs an end-to-end posture check with clear, actionable outcomes:

  • Enumerates accessible compartments (OCI Identity)

  • Collects block volumes, boot volumes and their backups (OCI Block Volume)

  • Correlates attached instances for each volume (OCI Compute)

  • Flags each volume’s posture using a simple policy threshold: COMPLIANT, STALE_BACKUP, NO_BACKUP

  • Writes reports locally in .json + .md formats

  • Uploads the reports to OCI Object Storage


High Level Architecture

The repository is structured in a clean, modular way so it is easy to extend:

  • collectors/ for OCI service data collection

  • analyzers/ for compliance logic and posture classification

  • helpers/ for report writing + Object Storage upload helpers

  • main.py as the orchestration entry point

Operationally, it follows a straightforward pipeline: discover compartments → collect volumes/backups → analyze posture → generate artifacts → upload artifacts.


Prerequisites

To run this project you will need:

  • Python 3.10+

  • OCI config profile configured (for example ~/.oci/config)

  • IAM permissions for read-only listing plus Object Storage upload (including compute/block volume visibility and put-object)


Configuration

The tool supports optional environment variables via .env.example. One particularly useful knob is the maximum allowed backup age threshold (so you can define what stale means in your environment).
Examples include: OCI_ROOT_COMPARTMENT_OCID, OCI_REGION, OCI_MAX_BACKUP_AGE_DAYS and Object Storage namespace/bucket settings (with auto detection supported if omitted).


Expected Output

Each run generates two timestamped artifacts in output/:

  • block_volume_backup_posture_<timestamp>.json

  • block_volume_backup_posture_<timestamp>.md

Then the same artifacts are uploaded to Object Storage using an oci://<bucket>@<namespace>/<prefix>/... pattern, which makes it easy to keep a consistent audit trail.


Safety Notes

This tool performs no destructive operations. It only reads from Identity/Compute/Block Volume APIs and writes the generated report artifacts locally, with the optional upload to Object Storage as the only write action. 

Comments

Popular posts from this blog

Your Cloud Is Talking Are You Listening OCI Logging Events and Notifications

OCI Network Exposure Scanner

When Your Apps Refuse to Talk Oracle Integration Cloud for the Rest of Us