Interview Prep/Real-World Interview/Data loss and corruption

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.

All Real-World Interview questions Roadmap: Interview readiness

More on Data loss and corruption