1

I have a AWS Cloudformation template (yaml-format) like this:

Datastore:
    Type: AWS::IoTAnalytics::Datastore
    Properties:
      DatastoreName: "DatastoreName"
      DatastoreStorage:
        ServiceManagedS3: ""
      RetentionPeriod:
        NumberOfDays: 7

I want to define a ServiceManagedS3-Bucket. Official documentation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-servicemanageds3.html) says it should just be an empty object. But when I do like above I get the following error: Property validation failure: [Value of property {/DatastoreStorage/ServiceManagedS3} does not match type {Object}]. If I change to an empty row like following Cloudformation complains about a null value.

      DatastoreStorage:
        ServiceManagedS3:
          
      RetentionPeriod:
        NumberOfDays: 7

Am I using the wrong .yaml-Syntax or what else am I doing wrong here? What is the correct way to declare an empty object?

Flash91
  • 148
  • 1
  • 1
  • 12
  • 1
    Empty object would be: `ServiceManagedS3: {}`. Can you try this way? – Marcin Sep 18 '20 at 08:56
  • 1
    Ah great, thanks! This works. I researched for the reason: So yaml is a superset of JSON, so JSON-Code works here as an empty object. It can be so easy ;) Here for more information: https://stackoverflow.com/a/1729545/6823586 – Flash91 Sep 18 '20 at 08:58
  • Glad to hear. If you don't mind, I will provide an answer for future reference. – Marcin Sep 18 '20 at 09:07

1 Answers1

1

Based on the comments.

The empty ServiceManagedS3 object is defined as follows:

ServiceManagedS3: {}

Therefore, the resource should be:

Datastore:
    Type: AWS::IoTAnalytics::Datastore
    Properties:
      DatastoreName: "DatastoreName"
      DatastoreStorage:
        ServiceManagedS3: {}
      RetentionPeriod:
        NumberOfDays: 7
Marcin
  • 215,873
  • 14
  • 235
  • 294