Complete the code to specify the partition key attribute in a DynamoDB table creation.
KeySchema=[{'AttributeName': '[1]', 'KeyType': 'HASH'}]The partition key is the primary key attribute used to distribute data across partitions. 'UserId' is a common choice to avoid hot partitions.
Complete the code to add a sort key to the DynamoDB table schema.
KeySchema=[{'AttributeName': 'UserId', 'KeyType': 'HASH'}, {'AttributeName': '[1]', 'KeyType': 'RANGE'}]The sort key allows sorting items with the same partition key. 'Timestamp' is often used to order events.
Fix the error in the partition key design to prevent hot partitions by using a composite key pattern.
PartitionKey = userId + '[1]'
Adding 'Region' to the partition key helps distribute traffic across partitions, reducing hot partition risk.
Fill both blanks to create a partition key that includes a user ID and a hashed value to spread load evenly.
PartitionKey = '[1]' + '#' + hash([2])
Combining 'UserId' with a hash of 'Timestamp' helps distribute writes across partitions by adding randomness.
Fill all three blanks to create a DynamoDB item with a partition key, sort key, and an attribute to prevent hot partitions.
Item = {'PartitionKey': [1], 'SortKey': [2], 'Region': [3]The partition key combines user ID with a hash to spread load. The sort key is timestamp for ordering. The region attribute helps identify data location and can be used for further distribution.