Bird
0
0

Which of the following is the correct syntax to define a Global Secondary Index (GSI) in a DynamoDB table using AWS CloudFormation?

easy📝 Configuration Q12 of 15
AWS - DynamoDB
Which of the following is the correct syntax to define a Global Secondary Index (GSI) in a DynamoDB table using AWS CloudFormation?
A"GlobalSecondaryIndexes": [{"IndexName": "GSI1", "KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}], "Projection": {"ProjectionType": "KEYS_ONLY"}}]
B"LocalSecondaryIndexes": [{"IndexName": "GSI1", "KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}], "Projection": {"ProjectionType": "ALL"}}]
C"GlobalSecondaryIndexes": [{"IndexName": "GSI1", "KeySchema": [{"AttributeName": "UserId", "KeyType": "RANGE"}], "Projection": {"ProjectionType": "ALL"}}]
D"GlobalSecondaryIndexes": [{"IndexName": "GSI1", "KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}], "Projection": {"ProjectionType": "ALL"}}]
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct index type and key schema

    GlobalSecondaryIndexes is the correct property for GSI, and the partition key must have KeyType "HASH".
  2. Step 2: Check projection type and syntax

    ProjectionType "ALL" is valid and commonly used; syntax matches CloudFormation format.
  3. Final Answer:

    "GlobalSecondaryIndexes": [{"IndexName": "GSI1", "KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}], "Projection": {"ProjectionType": "ALL"}}] -> Option D
  4. Quick Check:

    GSI uses GlobalSecondaryIndexes with HASH key [OK]
Quick Trick: GSI uses GlobalSecondaryIndexes with HASH key [OK]
Common Mistakes:
MISTAKES
  • Using LocalSecondaryIndexes for GSI
  • Setting KeyType to RANGE for partition key
  • Incorrect projection types or syntax errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes