Bird
0
0

Which of the following is the best approach?

hard📝 Best Practice Q15 of 15
AWS - DynamoDB
You want to create a DynamoDB table named Sessions with a composite primary key: UserId (string) as HASH and SessionId (string) as RANGE. You also want to set autoscaling for read and write capacity. Which of the following is the best approach?
ACreate the table without specifying key schema and add keys later
BUse <code>aws dynamodb create-table</code> with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service
CUse <code>aws dynamodb create-table</code> with only HASH key and enable autoscaling in the same command
DCreate the table with fixed provisioned throughput and manually update capacity when needed
Step-by-Step Solution
Solution:
  1. Step 1: Define table with composite primary key

    Use create-table with attribute definitions for UserId and SessionId, and key schema with HASH and RANGE keys.
  2. Step 2: Configure autoscaling separately

    DynamoDB autoscaling is set up via Application Auto Scaling service after table creation; it cannot be enabled directly in create-table command.
  3. Final Answer:

    Use aws dynamodb create-table with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service -> Option B
  4. Quick Check:

    Composite key + separate autoscaling setup = Use aws dynamodb create-table with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service [OK]
Quick Trick: Create table first, then set autoscaling separately [OK]
Common Mistakes:
MISTAKES
  • Trying to enable autoscaling in create-table command
  • Skipping RANGE key for composite key
  • Creating table without key schema

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes