A month-end report finds that invoice PDFs older than 30 days are missing from S3.
BeginnerTroubleshootingData loss and corruption
Answer
Likely causes → An S3 lifecycle rule with an expiration action applies to the wrong prefix or the whole bucket, for example a rule meant for tmp/ that was created with an empty filter.
Diagnose →
aws s3api get-bucket-lifecycle-configuration --bucket acme-docs
aws s3api list-object-versions --bucket acme-docs --prefix invoices/ --max-items 5
CloudTrail shows who created or changed the lifecycle rule (PutBucketLifecycleConfiguration).
Fix → Fix or remove the rule right away. If versioning was on, previous versions may still exist (until a noncurrent-version expiration removes them); restore them. Otherwise restore from backups or replicas, or regenerate the PDFs from source data.
Prevent → Lifecycle rules in Terraform with review, always scoped by prefix or tag, versioning plus replication for business records, and S3 Inventory reports to watch object counts.
More on Data loss and corruption
An engineer ran `DELETE FROM orders;` on the production Postgres (forgot the `WHERE`) at 14:32.BeginnerA cleanup script deleted every object under `s3://acme-invoices/2025/`. Versioning is enabled.BeginnerYou need to restore last night's MySQL backup and discover the dump files for the past three months are 20 KB each.IntermediateUsers update their profile, the page reloads, and they see the old values; a minute later the new values show up.IntermediateA network partition between data centres lasted 4 minutes; afterwards you find both sites accepted writes as primary, and the same order IDs exist with different contents.AdvancedA deploy ran a migration that dropped the `phone` column; old pods still running during the rolling update threw 500s, and a background job wrote nulls into a new table.Intermediate