属性 事件的值在 S3 存储桶的 TopicConfigurations 中的 CloudFormation 中必须是字符串类型
Value of property Event must be of type String in CloudFormation in TopicConfigurations for an S3 bucket
我在 cloudformation 模板中有这段代码:
"MyBucket": {
"Type" : "AWS::S3::Bucket",
"Properties" : {
"NotificationConfiguration": {
"TopicConfigurations": [
{
"Event": ["s3:ObjectCreated:Put" , "s3:ObjectCreated:Post"],
"Topic": { "Ref": "TopicSNS" }
}
]
}
}
}
通过在 CloudFormation 中创建堆栈来测试此代码后,出现此错误:Value of property Event must be of type String
且创建失败。
这样做的理由是什么?
谢谢
您正在将列表传递给 Event
属性,但是 Event
requires a string value。要配置多个事件,请创建多个 TopicConfigurations
对象:
"MyBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"NotificationConfiguration": {
"TopicConfigurations": [
{
"Event": "s3:ObjectCreated:Put",
"Topic": {
"Ref": "TopicSNS"
}
},
{
"Event": "s3:ObjectCreated:Post",
"Topic": {
"Ref": "TopicSNS"
}
}
]
}
}
}
我在 cloudformation 模板中有这段代码:
"MyBucket": {
"Type" : "AWS::S3::Bucket",
"Properties" : {
"NotificationConfiguration": {
"TopicConfigurations": [
{
"Event": ["s3:ObjectCreated:Put" , "s3:ObjectCreated:Post"],
"Topic": { "Ref": "TopicSNS" }
}
]
}
}
}
通过在 CloudFormation 中创建堆栈来测试此代码后,出现此错误:Value of property Event must be of type String
且创建失败。
这样做的理由是什么?
谢谢
您正在将列表传递给 Event
属性,但是 Event
requires a string value。要配置多个事件,请创建多个 TopicConfigurations
对象:
"MyBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"NotificationConfiguration": {
"TopicConfigurations": [
{
"Event": "s3:ObjectCreated:Put",
"Topic": {
"Ref": "TopicSNS"
}
},
{
"Event": "s3:ObjectCreated:Post",
"Topic": {
"Ref": "TopicSNS"
}
}
]
}
}
}