Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Status on AWS S3 cross region replication delete operations behaviour

I've been surprised to find out that file deletion was not replicated in a S3 bucket Cross Region Replication situation, running this simple test:

  1. simplest configuration of a CRR
  2. upload a new file
  3. check it is replicated
  4. delete the file (not a version of the file)

So I checked the documentation and I find this statement:

If you delete an object from the source bucket, the following occurs:

  • If you make a DELETE request without specifying an object version ID, Amazon S3 adds a delete marker. Amazon S3 deals with the delete marker as follows:
    • If using latest version of the replication configuration, that is you specify the Filter element in a replication configuration rule, Amazon S3 does not replicate the delete marker.
    • If don't specify the Filter element, Amazon S3 assumes replication configuration is a prior version V1. In the earlier version, Amazon S3 handled replication of delete markers differently. For more information, see Backward Compatibility .

The later link to backward compat tell me that:

  • When you delete an object from your source bucket without specifying an object version ID, Amazon S3 adds a delete marker. If you use V1 of the replication configuration XML, Amazon S3 replicates delete markers that resulted from user actions.[...] In V2, Amazon S3 doesn't replicate delete markers and therefore you must set the DeleteMarkerReplication element to Disabled.

So if I sum this up:

  • CRR configuration is considered v1 if there is no Filter
  • with CRR configuration v1, file deletion is replicated, not with v2

Well, this is my configuration :

{
    "ReplicationConfiguration": {
        "Role": "arn:aws:iam::271226720751:role/service-role/s3crr_role_for_mybucket_to_myreplica",
        "Rules": [
            {
                "ID": "first replication rule",
                "Status": "Enabled",
                "Destination": {
                    "Bucket": "arn:aws:s3:::myreplica"
                }
            }
        ]
    }
}

And deletion is not replicated. So it makes me think that my configuration is still considered V2 (even if I have no filter).


So, can someone confirm this presumption? And could someone tell me what does:

In V2, Amazon S3 doesn't replicate delete markers and therefore you must set the DeleteMarkerReplication element to Disabled

really mean?

like image 510
romain Avatar asked Oct 17 '18 11:10

romain


People also ask

Does S3 replication delete objects?

By default, when S3 Replication is enabled and an object is deleted in the source bucket, Amazon S3 adds a delete marker in the source bucket only. This action protects data from malicious deletions.

How does S3 Cross region replication work?

With cross-region replication, every object uploaded to an S3 bucket is automatically replicated to a destination bucket in a different AWS region that you choose. For example, you can use cross-region replication to provide lower-latency data access in different geographic regions.

What happens if you delete a delete marker in S3?

A delete marker in Amazon S3 is a placeholder (or marker) for a versioned object that was named in a simple DELETE request. Because the object is in a versioning-enabled bucket, the object is not deleted. But the delete marker makes Amazon S3 behave as if it is deleted.

Does S3 have cross region replication?

S3 Cross-Region Replication (CRR) is used to copy objects across Amazon S3 buckets in different AWS Regions.


1 Answers

There are two different configuration when replicating delete marker, V1 and V2.

Currently, when you enable S3 Replication (CRR or SRR) from the console, V2 configuration is enabled by default. However, if your use case requires you to delete replicated objects whenever they are deleted from the source bucket, you need the V1 configuration

Here is the difference between V1 and V2:

  • V1 configuration

The delete marker is replicated (V1 configuration). A subsequent GET request to the deleted object in both the source and the destination bucket does not return the object.

  • V2 configuration

The delete marker is not replicated (V2 configuration). A subsequent GET request to the deleted object returns the object only in the destination bucket.

To enable V1 configuration (to replicate delete marker), use the policy below. Keep in mind that certain replication features such as tag-based filtering and Replication Time Control (RTC) that are only available in V2 configurations.

{
    "Role": " IAM-role-ARN ",
    "Rules": [
        {
            "ID": "Replication V1 Rule",
            "Prefix": "",
            "Status": "Enabled",
            "Destination": {
                "Bucket": "arn:aws:s3:::<destination-bucket>"
            }
        }
    ]
}

Here is the blog that describes these behavior in details: https://aws.amazon.com/blogs/storage/managing-delete-marker-replication-in-amazon-s3/

like image 126
vik1234 Avatar answered Oct 06 '22 00:10

vik1234