Schedule icon
Webhook icon
Log icon
Parallel icon
List icon
Script icon
Process icon
If icon
Fail icon

Object Storage Integrity and Streaming Replica Parity Audit

Verify S3 replica parity, detect silent bitrot with streaming SHA-256 hashes, pinpoint differing byte offsets, and quarantine corrupted objects with Kestra.

Categories
CloudData

Verifies that replicated object storage buckets remain cryptographically identical, detecting missing files, size mismatches, and silent bitrot that standard metadata checks overlook.

How it works

  1. Dual Ingestion Triggers: Executes either on a recurring nightly schedule (daily_scheduled_audit) or immediately following an upstream object sync or replication pipeline event via authenticated webhook (replication_sync_webhook).
  2. Parallel Inventory Listing (parallel_inventory_extraction): Concurrently retrieves object keys, byte sizes, and metadata from both the primary bucket and replica bucket using io.kestra.plugin.aws.s3.List so comparisons reflect a consistent snapshot in time.
  3. Streaming Cryptographic Parity Engine (reconcile_and_verify_parity): Executes an in-memory streaming verification script (io.kestra.plugin.scripts.python.Script) that performs:
    • Inventory Set Reconciliation: Identifies objects missing from the replica, unexpected orphan objects in the replica, and byte size mismatches.
    • Streaming SHA-256 Digesting: Reads matching objects in bounded 64 KB binary chunks across both storage endpoints without buffering entire multi-gigabyte files into RAM, computing true cryptographic SHA-256 checksums to bypass multipart ETag limitations.
    • First Differing Byte Offset Detection: When a checksum mismatch occurs, compares the byte streams directly to identify the exact 0-indexed byte offset and hexadecimal delta where corruption occurred.
    • Operational Error Isolation: Classifies network timeouts, read failures, and 403 permission errors as operational diagnostics rather than misclassifying inaccessible objects as healthy.
    • Safe Opt-in Quarantine: When enable_quarantine is true, copies corrupted replica objects into a dedicated quarantine prefix (quarantine-isolated/) and produces an immutable audit receipt. The primary source is never modified or deleted.
    • Structured Audit Manifest: Exports a comprehensive machine-readable integrity_audit_report.json and emits execution variables via Kestra.outputs.
  4. Conditional Outcome Routing (route_audit_outcome): Inspects the audit result using io.kestra.plugin.core.flow.If:
    • Pass Branch: Logs an audit certification statement with total verified objects, byte counts, and cryptographic confirmation.
    • Fail Branch: Logs an alert with exact mismatch breakdowns, details any quarantined objects, and halts downstream data pipelines via io.kestra.plugin.core.execution.Fail when fail_on_discrepancy is enabled.

What you get

  • True Cryptographic Parity: Detects silent data corruption and bitrot that pass standard size and ETag checks.
  • Exact Byte-Level Root Cause: Pinpoints the exact byte position where replica corruption starts, distinguishing header corruption from payload bitflips.
  • Zero-RAM-Exhaustion Streaming: Bounded 64 KB chunk buffers enable auditing large files and data lake partitions without memory spikes.
  • Safe Remediation by Default: Report-only mode is enforced by default. Source data is never modified, and quarantine requires explicit configuration.
  • Audit-Ready Evidence: Emits a structured JSON report mapping verified keys, missing files, checksum mismatches, and operational errors.

Who it's for

  • Data Platform & Lakehouse Engineers validating Parquet, Iceberg, and Delta table replicas before downstream analytical queries run.
  • Cloud Infrastructure & SRE Teams auditing cross-region S3 replication, MinIO mirrors, and cloud disaster recovery targets.
  • Compliance & Security Engineers requiring verifiable cryptographic proof that archive storage has not been tampered with or corrupted.

Why orchestrate this with Kestra

  • Combines concurrent S3 API calls (Parallel), streaming analytical Python processing, and conditional governance routing (If, Fail) in a single version-controlled YAML definition.
  • Native secret masking ensures AWS and MinIO access credentials are never exposed in task parameters, execution logs, or exported reports.
  • Parameterized inputs allow teams to audit production buckets, local MinIO clusters, or staging prefixes with zero code modifications.

Prerequisites

  • A running Kestra instance with the AWS plugin (io.kestra.plugin.aws) and Python Script plugin (io.kestra.plugin.scripts.python) available.
  • Network connectivity to the primary and replica S3-compatible endpoints.
  • S3 IAM credentials with s3:ListBucket and s3:GetObject on both buckets. If optional quarantine is enabled, s3:PutObject and s3:DeleteObject are required on the replica bucket only.

Secrets

  • PRIMARY_S3_ACCESS_KEY_ID: Access key ID for the primary S3-compatible storage location.
  • PRIMARY_S3_SECRET_ACCESS_KEY: Secret access key for the primary storage location.
  • REPLICA_S3_ACCESS_KEY_ID: Access key ID for the replica S3-compatible storage location.
  • REPLICA_S3_SECRET_ACCESS_KEY: Secret access key for the replica storage location.

Quick start

  1. Configure the four required S3 secrets in your Kestra namespace or environment.
  2. Import this blueprint into Kestra and configure primary_bucket and replica_bucket. For local testing with MinIO, provide primary_endpoint and replica_endpoint (e.g. http://localhost:9000).
  3. Click Execute with default parameters (enable_quarantine: false) to perform a safe, read-only audit.
  4. Review the generated integrity_audit_report.json under the execution's Outputs tab.
  5. Enable the schedule or point your replication notification webhook at replication_sync_webhook.

How to extend

  • Attach Downstream ETL Gating: Trigger downstream dbt, DuckDB, or Spark ingestion flows only after this workflow emits a passing parity attestation.
  • Multi-Channel Alerting: Add Slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook), PagerDuty, or Microsoft Teams tasks inside the discrepancy branch.
  • Incremental Watermarking: Persist audited object keys and timestamps into Kestra's KV store (io.kestra.plugin.core.kv) to skip immutable historical partitions.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.