在 Cloudformation 中创建 DynamoDB table 失败
Creating a DynamoDB table in Cloudformation fails
我收到以下错误:
Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes
但我不确定这里出了什么问题。
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"
您不需要在此处指定 DynamoDB table 的所有属性。 cloudformation 需要的只是键和索引属性的定义。
因此,如果您将 AttributeDefinition 减少为 uuid
和 timestamp
,应该没问题(只要您没有二级索引)。
这里是 CloudFormation 文档中关于此主题的部分:
A list of attributes that describe the key schema for the table and
indexes. Duplicates are allowed.
我收到以下错误:
Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes
但我不确定这里出了什么问题。
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"
您不需要在此处指定 DynamoDB table 的所有属性。 cloudformation 需要的只是键和索引属性的定义。
因此,如果您将 AttributeDefinition 减少为 uuid
和 timestamp
,应该没问题(只要您没有二级索引)。
这里是 CloudFormation 文档中关于此主题的部分:
A list of attributes that describe the key schema for the table and indexes. Duplicates are allowed.