我在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
并且创建失败。
那是什么存在的理由?
谢谢
答案 0 :(得分:0)
您已将列表传递给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"
}
}
]
}
}
}