问题描述
我有一个这样的AWS Cloudformation模板(yaml格式):
Datastore:
Type: AWS::IoTAnalytics::Datastore
Properties:
DatastoreName: "DatastoreName"
DatastoreStorage:
ServiceManagedS3: ""
RetentionPeriod:
NumberOfDays: 7
我想定义一个ServiceManagedS3-Bucket。官方文档(https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-servicemanageds3.html)表示它应该只是一个空对象。但是当我喜欢上面的操作时,会出现以下错误:Property validation failure: [Value of property {/DatastoreStorage/ServiceManagedS3} does not match type {Object}]
。如果我像下面这样更改为空行,Cloudformation会抱怨为空值。
DatastoreStorage:
ServiceManagedS3:
RetentionPeriod:
NumberOfDays: 7
我使用的是错误的.yaml语法还是在这里做错了什么?声明空对象的正确方法是什么?
解决方法
基于评论。
空的ServiceManagedS3
对象定义如下:
ServiceManagedS3: {}
因此,资源应为:
Datastore:
Type: AWS::IoTAnalytics::Datastore
Properties:
DatastoreName: "DatastoreName"
DatastoreStorage:
ServiceManagedS3: {}
RetentionPeriod:
NumberOfDays: 7