Which approach should I use to bulk-restore R2 object versions while excluding intentionally deleted objects?
0 reputation · 08 Oct 2020, 03:07 UTC
0 reputation · 08 Oct 2020, 03:07 UTC
I have an R2 bucket with object versioning enabled, and I need to recover a large number of objects after an accidental mass overwrite and deletion event. From the documentation, restoring a prior version means copying that version forward or removing delete markers via the S3-compatible API — there is no single "restore bucket to a timestamp" operation, so this has to be scripted.
The part I cannot resolve is how to distinguish objects that were intentionally deleted weeks ago from objects deleted during the incident. Listing versions and blindly removing every delete marker would resurrect data that was supposed to stay gone. I have object metadata (ETag, size, last-modified per version) available, but no application-level audit log of deletions.
I also understand that ETags from multipart uploads are not plain MD5 hashes of the content, so checksum verification against a pre-incident manifest needs to account for that.
My questions:
Assume current R2 behavior as of late 2026; I will verify against the latest docs before running anything in production.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.