I am trying to create a Dynamo DB table using CloudFormation. I want two attributes combined as the hash key. For example,
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"
In this case, I want the combination of both "a1" and "a2" to be hash key and similarly, I want the combination of "a3" and "a4" to be my range key.
- Hash key: a1, a2
- Range key: a3, a4
How do I achieve this? I am looking for a solution that doesn't use GSI or LSI.