我正在尝试通过 AWS CLI 放置存储桶复制跨账户:
AWS S3API 放置存储桶复制 --bucket "mybucket" --replication-configuration "{\"Role\": \"arn:aws:iam::xxxxxxx:role/buckets-replication\", \"Rules\": [{ "状态": "已启用", "优先级": 1, "删除标记复制": { \"状态": \"已启用\" }, \"目标": { \"存储桶": \"arn:aws:s3::mybucket-destination\", \"AccessControlTranslation\": { \"所有者": \"目的地\" } } }]}" --区域 "eu-west-1" --profile 违约
我收到此错误:
调用 PutBucketReplication 时出错(格式不正确的 XML( 操作:您提供的 XML 格式不正确或未正确 根据已发布的架构进行验证
对应的 Xml 是:
<ReplicationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Role>string</Role>
<Rule>
<Status>string</Status>
<Priority>integer</Priority>
<DeleteMarkerReplication>
<Status>string</Status>
</DeleteMarkerReplication>
<Destination>
<Bucket>string</Bucket>
<AccessControlTranslation>
<Owner>string</Owner>
</AccessControlTranslation>
</Destination>
</Rule>
</ReplicationConfiguration>
我真的看不出语法有什么问题。我遵循了以下文档:https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketReplication.html#AmazonS3-PutBucketReplication-request-Role
似乎
<DeleteMarkerReplication> <Status>string</Status> </DeleteMarkerReplication>
是必需的,即使设置为"已禁用"。