Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define the partition key attribute name in a DynamoDB table.
DynamoDB
KeySchema=[{"AttributeName": "[1]", "KeyType": "HASH"}] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the sort key attribute name as the partition key.
Choosing an attribute that is not unique.
✗ Incorrect
The partition key attribute name is typically a unique identifier like UserId.
2fill in blank
mediumComplete the code to specify the attribute type for the partition key in DynamoDB.
DynamoDB
AttributeDefinitions=[{"AttributeName": "UserId", "AttributeType": "[1]"}] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using BOOL as an attribute type for partition key.
Confusing number (N) with string (S).
✗ Incorrect
The partition key attribute type is usually a string, represented by S in DynamoDB.
3fill in blank
hardFix the error in the partition key definition by completing the missing part.
DynamoDB
KeySchema=[{"AttributeName": "UserId", "KeyType": "[1]"}] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using RANGE instead of HASH for partition key.
Using invalid key types like PRIMARY or SORT.
✗ Incorrect
The partition key must have the key type HASH in DynamoDB.
4fill in blank
hardFill both blanks to define a composite key with partition and sort keys.
DynamoDB
KeySchema=[{"AttributeName": "[1]", "KeyType": "HASH"}, {"AttributeName": "[2]", "KeyType": "RANGE"}] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping partition and sort key names.
Using non-unique attributes as partition key.
✗ Incorrect
The partition key is UserId and the sort key is Timestamp to order items.
5fill in blank
hardFill all three blanks to define attribute definitions for a composite key.
DynamoDB
AttributeDefinitions=[{"AttributeName": "[1]", "AttributeType": "S"}, {"AttributeName": "[2]", "AttributeType": "[3]"}] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string type for Timestamp when it should be number.
Mixing attribute names and types incorrectly.
✗ Incorrect
UserId is a string (S) and Timestamp is a number (N) attribute type.