【问题标题】:Creating a DynamoDB table in Cloudformation fails在 Cloudformation 中创建 DynamoDB 表失败
【发布时间】:2018-12-03 08:52:18
【问题描述】:

我收到以下错误:

Property AttributeDefinitions与表的KeySchema和二级索引不一致

但我不确定这里出了什么问题。

  FeedbackTable: 
    Type: "AWS::DynamoDB::Table"
    Properties: 
      AttributeDefinitions: 
        - 
          AttributeName: "uuid"
          AttributeType: "S"
        - 
          AttributeName: "timestamp"
          AttributeType: "N"
        - 
          AttributeName: "pros"
          AttributeType: "S"
        - 
          AttributeName: "cons"
          AttributeType: "S"
        - 
          AttributeName: "comments"
          AttributeType: "S"
        - 
          AttributeName: "options"
          AttributeType: "S"
        - 
          AttributeName: "luaA"
          AttributeType: "S"
        - 
          AttributeName: "luaB"
          AttributeType: "S"
        - 
          AttributeName: "luaC"
          AttributeType: "S"
      KeySchema: 
        - 
          AttributeName: "uuid"
          KeyType: "HASH"
        - 
          AttributeName: "timestamp"
          KeyType: "RANGE"
      ProvisionedThroughput: 
        ReadCapacityUnits: "1"
        WriteCapacityUnits: "1"
      TableName: "BD_Feedback"

【问题讨论】:

    标签: amazon-dynamodb amazon-cloudformation


    【解决方案1】:

    您无需在此处指定 DynamoDB 表的所有属性。 cloudformation 需要的只是键和索引属性的定义。

    因此,如果您将 AttributeDefinition 减少到 uuidtimestamp,应该没问题(只要您没有二级索引)。

    这里是 CloudFormation 文档中关于此主题的部分:

    描述表的关键模式的属性列表和 索引。允许重复。

    CloudFormation docs

    【讨论】:

      猜你喜欢
      • 2017-08-10
      • 1970-01-01
      • 2020-05-12
      • 2019-10-30
      • 2020-02-27
      • 2021-06-29
      • 2021-04-06
      • 2020-11-06
      • 2023-03-13
      相关资源
      最近更新 更多