【发布时间】:2021-04-05 20:52:32
【问题描述】:
我正在尝试在 DynamoDB 中创建显示在底部的表,但出现此错误。我知道您不能定义多个 PK,但 GSI-PK 也是如此吗?如何修复错误?
2 validation errors detected: Value '[KeySchemaElement(attributeName=VenueID, keyType=HASH), KeySchemaElement(attributeName=VenueName, keyType=Range), KeySchemaElement(attributeName=CheckInID, keyType=HASH)]' at 'globalSecondaryIndexes.1.member.keySchema' failed to satisfy constraint: Member must have length less than or equal to 2;
Value 'Range' at 'globalSecondaryIndexes.1.member.keySchema.2.member.keyType' failed to satisfy constraint: Member must satisfy enum value set: [HASH, RANGE]
Serverless.yml
resources:
Resources:
BeaconTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.beaconsTable}
AttributeDefinitions:
- AttributeName: BeaconAddr
AttributeType: S
- AttributeName: VenueID
AttributeType: S
- AttributeName: VenueName
AttributeType: S
- AttributeName: CheckInID
AttributeType: S
KeySchema:
- AttributeName: BeaconAddr
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: BeaconAddr-index
KeySchema:
- AttributeName: VenueID
KeyType: HASH
- AttributeName: VenueName
KeyType: Range
- AttributeName: CheckInID
KeyType: HASH
Projection:
ProjectionType: "ALL"
BillingMode: PAY_PER_REQUEST
【问题讨论】:
标签: amazon-web-services amazon-dynamodb serverless-framework