AWS S3 CDK Python 桶复制配置
AWS S3 CDK Python Bucket replication configuration
我正在使用 CDK python 创建和跨区域的 S3 存储桶和 replication.configuration
我在合成时一直出错:
值与联合中的任何类型都不匹配
这是我的规则部分的代码 s3.CfnBucket.ReplicationConfigurationProperty:
谁能看看我源码选择区的代码。我认为这就是问题所在:
self.replication_conf = s3.CfnBucket.ReplicationConfigurationProperty(
role=new_role_arn,
rules=[
s3.CfnBucket.ReplicationRuleProperty(
id='replicate-all-rule',
destination=some_arn,
status='Enabled',
source_selection_criteria = s3.CfnBucket.SseKmsEncryptedObjectsProperty(
status='Enabled'
)
)
]
)
看来你的语法完全不正确。
根据 the documentation,source_selection_criteria
应该是 SourceSelectionCriteriaProperty
类型。 属性 持有 SseKmsEncryptedObjectsProperty
。大概这是正确的(尽管未经测试):
self.replication_conf = s3.CfnBucket.ReplicationConfigurationProperty(
role=new_role_arn,
rules=[
s3.CfnBucket.ReplicationRuleProperty(
id='replicate-all-rule',
destination=some_arn,
status='Enabled',
source_selection_criteria=s3.CfnBucket.SourceSelectionCriteriaProperty(
sse_kms_encrypted_objects=s3.CfnBucket.SseKmsEncryptedObjectsProperty(
status='Enabled'
)
)
)
]
)
我正在使用 CDK python 创建和跨区域的 S3 存储桶和 replication.configuration
我在合成时一直出错:
值与联合中的任何类型都不匹配
这是我的规则部分的代码 s3.CfnBucket.ReplicationConfigurationProperty:
谁能看看我源码选择区的代码。我认为这就是问题所在:
self.replication_conf = s3.CfnBucket.ReplicationConfigurationProperty(
role=new_role_arn,
rules=[
s3.CfnBucket.ReplicationRuleProperty(
id='replicate-all-rule',
destination=some_arn,
status='Enabled',
source_selection_criteria = s3.CfnBucket.SseKmsEncryptedObjectsProperty(
status='Enabled'
)
)
]
)
看来你的语法完全不正确。
根据 the documentation,source_selection_criteria
应该是 SourceSelectionCriteriaProperty
类型。 属性 持有 SseKmsEncryptedObjectsProperty
。大概这是正确的(尽管未经测试):
self.replication_conf = s3.CfnBucket.ReplicationConfigurationProperty(
role=new_role_arn,
rules=[
s3.CfnBucket.ReplicationRuleProperty(
id='replicate-all-rule',
destination=some_arn,
status='Enabled',
source_selection_criteria=s3.CfnBucket.SourceSelectionCriteriaProperty(
sse_kms_encrypted_objects=s3.CfnBucket.SseKmsEncryptedObjectsProperty(
status='Enabled'
)
)
)
]
)