2016-12-01 24 views
1

我有这样的代码在cloudformation模板:Value属性事件必须在CloudFormation String类型的TopicConfigurations一个S3桶

 "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

您正将一个列表传递给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" 
      } 
     } 
     ] 
    } 
    } 
} 
相关问题