0
votes

I've been trying to deploy a Dynamo db using a cloud formation template and I keep getting the following error that the property AttributeType does not exist.

the yaml definition looks like:

 MyDynoDB:
    Type: AWS::DynamoDB::Table
    Properties: 
      TableName: 'MyDynamoDb'
      AttributeDefinitions: 
        - AttributeName: 'Id'
          AttributeType: 'S'
        - AttributeName: 'Name'
          AttributeType: 'S'
      KeySchema: 
        - AttributeName: 'Id'
          KeyType: HASH
        - AttributeName: 'Name'
          KeyType: 'S'
      ProvisionedThroughput: 
        ReadCapacityUnits: 5
        WriteCapacityUnits: 5
      StreamSpecification:
        StreamViewType: NEW_AND_OLD_IMAGES

The stack will deploy but goes into rollback mode withe the following error.

CREATE_FAILED   AWS::DynamoDB::Table    MyDynoDB    Encountered unsupported property AttributeType

Why am I seeing this error being generated?

UPDATE

based on the comments I've updated the Attribute and Key Schema definitions to now show:

AttributeDefinitions: 
        - 
          AttributeName: Id
          AttributeType: S
        - 
          AttributeName: Name
          AttributeType: S
      KeySchema: 
        - 
          AttributeName: Id
          KeyType: HASH
        - 
          AttributeName: Name
          KeyType: RANGE

Unfortunately still seeing the same error

1
Can you try to update the KeyType: 'S' to some valid value. KeyType is only either HASH or RANGE.sayboras
Your file looks fine. Perhaps this is a YAML error because of indentation issues? Make sure that you are consistently using tabs or spaces the same depth for all lines. I have seem these types of YAML schema errors pop up before because of indentation.JD D
I updated VSCode settings to show white space and it was correct. The issue ended up being the cli was not overwriting the packaged template with the new one based upon the changes being made.rlcrews
As mentioned above, very much likely this is an indentation problem. Fixed mine by copying sample from the documentation and updating it with my data.Diana

1 Answers

0
votes

Found the issue. When making changes to the template such as changing the AttributeType from S to HASH or other property edits the compiled yaml file was not being updated. It was as if the CLI was not detecting the change and therefore would not update/overwrite the file with the new changes when packaging. To correct this I deleted the build folder where the packages were being saved to and re-deployed, deployment was successful.