3
votes

I am trying to create DynamoDB table with AWS Cloudformation and YAML defintions. When I remove the Type from YAML file I get error that Type must be present. So I suppose I am missing something just can't seem to find it.

Here are the YAML defintions:

Resources:
    devDdbDataTable:
      Type: 'AWS::DynamoDB::Table'
      Properties:
        Tags:
          - Key: access_key
            Value: '123'
        AttributeDefinitions:
          - AttributeName: device_id
            Type: 'N'
          - AttributeName: device_ip
            Type: S
          - AttributeName: data
            Type: S
          - AttributeName: created_at
            Type: S
          - AttributeName: ttl
            Type: S
        KeySchema:
          - AttributeName: device_id
            Type: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TimeToLiveSpecification:
          AttributeName: ttl
          Enabled: true
1

1 Answers

3
votes

The problem is not at Resources.devDdbDataTable.Type but instead the problem is at Resources.devDdbDataTable.Properties.AttributeDefinitions.Type.

AttributeDefinitions should be a list like this:

AttributeDefinitions:
  - AttributeName: device_id
    AttributeType: 'N'

So change Type to AttributeType.