【发布时间】:2020-06-17 14:52:46
【问题描述】:
我正在尝试使用 CloudFormation 创建一个 Dynamo DB 表。我想要将两个属性组合为哈希键。例如,
ExampleTable:
Type: "AWS::DynamoDB::Table"
Description: This is an example table
Properties:
TableName: { 'Fn::Sub': 'example'}
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
AttributeDefinitions:
- AttributeName: "a1"
AttributeType: "S"
- AttributeName: "a2"
AttributeType: "N"
- AttributeName: "a3"
AttributeType: "S"
- AttributeName: "a4"
AttributeName: "S"
KeySchema:
- AttributeName: "a1"
KeyType: "HASH"
- AttributeName: "a2"
KeyType: "HASH"
- AttributeName: "a3"
KeyType: "Range"
- AttributeName: "a4"
KeyType: "Range"
在这种情况下,我希望“a1”和“a2”的组合成为哈希键,同样,我希望“a3”和“a4”的组合成为我的范围键。
- 哈希键:a1, a2
- 范围键:a3、a4
我如何实现这一目标?我正在寻找不使用 GSI 或 LSI 的解决方案。
【问题讨论】:
标签: database amazon-web-services amazon-dynamodb amazon-cloudformation