3列のコンポジットキーを持つdynamodbテーブルを定義しようとしています。これは可能ですか?DynamoDB用のserverless.ymlでどのように複合キーを定義できますか?
私はこのようなコードを持っている例やチュートリアルを見てきました:
resources:
Resources:
TodosDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
KeySchema:
-
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE}
をしかし、それは単一列のみと単一のキーを持っています。私はid
、server
とroom
上のキーが欲しい
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: N
- AttributeName: server
AttributeType: S
- AttributeName: room
AttributeType: S
- AttributeName: friendlyName
AttributeType: S
:私のテーブルはこのようになります。ユーザーは、同じサーバー上の複数の会議室と、複数のサーバー上の複数の会議室に参加することができます。しかし、3つのキーには、常にユニークなものがあります。
KeySchema
部分の定義方法がわかりません。どんな助け?