0
0
DynamoDBquery~10 mins

Creating GSI in DynamoDB - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a Global Secondary Index (GSI) with the partition key 'UserId'.

DynamoDB
"GlobalSecondaryIndexes": [{"IndexName": "UserIndex", "KeySchema": [{"AttributeName": [1], "KeyType": "HASH"}], "Projection": {"ProjectionType": "ALL"}}]
Drag options to blanks, or click blank then click option'
A"OrderId"
B"UserId"
C"Timestamp"
D"Status"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong attribute name for the partition key.
Confusing the sort key with the partition key.
2fill in blank
medium

Complete the code to add a sort key 'OrderDate' to the GSI.

DynamoDB
"KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}, {"AttributeName": [1], "KeyType": "RANGE"}]
Drag options to blanks, or click blank then click option'
A"Timestamp"
B"OrderId"
C"OrderDate"
D"Status"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the partition key attribute as the sort key.
Choosing an attribute that does not represent order date.
3fill in blank
hard

Fix the error in the attribute definitions by selecting the correct attribute type for 'OrderDate'.

DynamoDB
"AttributeDefinitions": [{"AttributeName": "UserId", "AttributeType": "S"}, {"AttributeName": "OrderDate", "AttributeType": [1]]
Drag options to blanks, or click blank then click option'
A"N"
B"B"
C"BOOL"
D"S"
Attempts:
3 left
💡 Hint
Common Mistakes
Using number (N) type for date strings.
Using binary (B) type incorrectly.
4fill in blank
hard

Fill both blanks to complete the GSI projection type and write capacity units.

DynamoDB
"ProvisionedThroughput": {"ReadCapacityUnits": 5, "WriteCapacityUnits": [1], "Projection": {"ProjectionType": [2]
Drag options to blanks, or click blank then click option'
A5
B10
C"ALL"
D"KEYS_ONLY"
Attempts:
3 left
💡 Hint
Common Mistakes
Setting write capacity units too low.
Choosing projection type 'KEYS_ONLY' when all attributes are needed.
5fill in blank
hard

Fill all three blanks to complete the GSI definition with index name, partition key, and projection type.

DynamoDB
"GlobalSecondaryIndexes": [{"IndexName": [1], "KeySchema": [{"AttributeName": [2], "KeyType": "HASH"}], "Projection": {"ProjectionType": [3]]
Drag options to blanks, or click blank then click option'
A"UserDateIndex"
B"UserId"
C"INCLUDE"
D"OrderIndex"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic index name.
Choosing wrong attribute for partition key.
Using projection type 'ALL' when only some attributes are needed.