Bird
0
0

What is wrong with this DynamoDB key schema definition?

medium📝 Debug Q14 of 15
AWS - DynamoDB

What is wrong with this DynamoDB key schema definition?

--attribute-definitions AttributeName=OrderId,AttributeType=S AttributeName=OrderDate,AttributeType=S --key-schema AttributeName=OrderDate,KeyType=HASH AttributeName=OrderId,KeyType=RANGE
AAttribute names cannot contain uppercase letters.
BAttribute types must be different for partition and sort keys.
CKeyType values must both be HASH for composite keys.
DPartition key and sort key are swapped; OrderId should be HASH, OrderDate RANGE.
Step-by-Step Solution
Solution:
  1. Step 1: Check key roles

    Partition key must be HASH and sort key must be RANGE in key schema.
  2. Step 2: Identify swapped keys

    OrderId should be the partition key (HASH), but here OrderDate is set as HASH and OrderId as RANGE, which is incorrect.
  3. Final Answer:

    Partition key and sort key are swapped; OrderId should be HASH, OrderDate RANGE. -> Option D
  4. Quick Check:

    Partition = HASH, Sort = RANGE order matters [OK]
Quick Trick: Partition key always HASH, sort key always RANGE [OK]
Common Mistakes:
  • Swapping HASH and RANGE key types
  • Assuming attribute types must differ
  • Thinking uppercase letters are invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes