AWS S3跨区域复制删除操作行为的状态 [英] Status on AWS S3 cross region replication delete operations behaviour

查看:122
本文介绍了AWS S3跨区域复制删除操作行为的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很惊讶地发现,在运行以下简单测试的情况下,文件删除未在S3存储桶跨区域复制"情况下被复制:

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. 最简单的CRR配置
  2. 上传新文件
  3. 检查是否已复制
  4. 删除文件(不是文件的版本)

所以我检查了

So I checked the documentation and I find this statement:

如果从源存储桶中删除对象,则会发生以下情况:

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

  • 如果您在未指定对象版本ID的情况下发出DELETE请求,则Amazon S3将添加一个删除标记. Amazon S3处理删除 标记如下:
    • 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:

      • 当您从源存储桶中删除对象而未指定对象版本ID时,Amazon S3将添加一个删除标记.如果您使用复制配置XML的V1,则Amazon S3将复制由用户操作导致的删除标记.[...] 在V2中,Amazon S3不复制删除标记,因此您必须将DeleteMarkerReplication元素设置为Disabled.
      • 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配置视为v1
      • 使用CRR配置v1,复制文件删除,而不使用v2

      好吧,这是我的配置:

      {
          "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"
                      }
                  }
              ]
          }
      }
      

      并且删除不被复制.因此,我认为我的配置仍被视为V2(即使没有过滤器也是如此).

      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:

      在V2中,Amazon S3不复制删除标记,因此您必须将DeleteMarkerReplication元素设置为Disabled

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

      是真的意思吗?

      推荐答案

      问题来自AWS尚不清晰的文档. 要使用DeleteMarkerReplication,您需要配置V1.要让AWS知道您想要V1,您需要在配置中指定Prefix元素,并且不指定DeleteMarkerReplication 元素,因此您的第一次尝试几乎是正确的.

      The issue comes from still not clear documentation from AWS. To use DeleteMarkerReplication, you need V1 of the configuration. To let AWS know that you want V1, you need to specify a Prefix element in your configuration, and no DeleteMarkerReplication element, so your first try was almost correct.

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

      }

      当然,您的策略中需要s3:ReplicateDelete权限.

      And of course you need the s3:ReplicateDelete permission in your policy.

      这篇关于AWS S3跨区域复制删除操作行为的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆