CloudFormation Dynamo数据库部署中不受支持的属性'AttributeType'

时间:2019-05-15 01:03:27

标签: amazon-dynamodb amazon-cloudformation

我一直在尝试使用云形成模板来部署Dynamo数据库,并且不断出现以下错误,即AttributeType属性不存在。

yaml定义如下:

 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

堆栈将部署,但进入回退模式,并出现以下错误。

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

为什么我会看到此错误?

更新

基于注释,我已经更新了“属性”和“关键架构”定义,现在可以显示:

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

不幸的是仍然看到相同的错误

1 个答案:

答案 0 :(得分:0)

发现了问题。在对模板进行更改(例如将AttributeType从S更改为HASH或其他属性)时,不会更新已编译的Yaml文件。好像CLI并未检测到更改,因此打包时不会使用新更改来更新/覆盖文件。 为了解决这个问题,我删除了将软件包保存到其中并重新部署的构建文件夹,部署成功。