Search code examples
amazon-s3replicationfailover

How do I work around inconsistency in AWS S3 replica bucket after file restore?


I had deleted file from source bucket. Source and replica are synchronized, both have delete marker. I delete the delete marker in source bucket to restore the file. But the file is deleted (has delete marker) in replica. It is by design:

If a DELETE request specifies a particular object version ID to delete, Amazon S3 deletes that object version in the source bucket, but it does not replicate the deletion in the destination bucket (in other words, it does not delete the same object version from the destination bucket). This behavior protects data from malicious deletions. https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-what-is-isnot-replicated.html

I need a consistent replica for failover. How do I prevent inconsistency in replica?


Solution

  • I see the only one way to save consistency:

    Never delete object versions, including delete markers.

    Reupload the object (create a new version) to restore it instead removing delete marker.