DynamoDB Attribute Definitions
This always trips me up so I'm writing it down, I hope this commits it to memory.
AttributeDefinitions = KeySchema + Indexes
So if the table has a KeySchema of {KeyType: "HASH", AttributeName: "my_primarykey"}
and an global secondary index named {KeyType: HASH, AttributeName: "my_index"}
then you simple add these into the AttributeDefinition and give their type. Like the following.
AttributeDefinitions:
- AttributeName: "my_primarykey"
AttributeType: S
- AttributeName: "my_index"
AttributeType: S
Very simple. It says this pretty much verbatim in the docks and yet I always spend five minutes futzing with it. No more!