Bird
0
0

Which of the following is the correct way to define a DynamoDB table with a partition key named UserId and a sort key named OrderDate in AWS CLI?

easy📝 Configuration Q12 of 15
AWS - DynamoDB

Which of the following is the correct way to define a DynamoDB table with a partition key named UserId and a sort key named OrderDate in AWS CLI?

aws dynamodb create-table --table-name Orders --attribute-definitions AttributeName=UserId,AttributeType=S AttributeName=OrderDate,AttributeType=S --key-schema ...
A--key-schema AttributeName=UserId,KeyType=HASH AttributeName=OrderDate,KeyType=RANGE
B--key-schema AttributeName=OrderDate,KeyType=HASH AttributeName=UserId,KeyType=RANGE
C--key-schema AttributeName=UserId,KeyType=RANGE AttributeName=OrderDate,KeyType=HASH
D--key-schema AttributeName=OrderDate,KeyType=RANGE AttributeName=UserId,KeyType=HASH
Step-by-Step Solution
Solution:
  1. Step 1: Identify partition and sort key roles

    The partition key uses KeyType=HASH and the sort key uses KeyType=RANGE in DynamoDB key schema.
  2. Step 2: Match keys to names

    UserId is the partition key (HASH), OrderDate is the sort key (RANGE).
  3. Final Answer:

    --key-schema AttributeName=UserId,KeyType=HASH AttributeName=OrderDate,KeyType=RANGE -> Option A
  4. Quick Check:

    Partition=HASH, Sort=RANGE [OK]
Quick Trick: Partition key = HASH, sort key = RANGE in key schema [OK]
Common Mistakes:
MISTAKES
  • Swapping HASH and RANGE key types
  • Mixing up partition and sort key names
  • Using wrong attribute types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes