AWS Certified Developer – Associate (DVA-C02) — Question 497

A company’s application includes an Amazon DynamoDB table for product orders. The table has a primary partition key of orderId and has no sort key. The company is adding a new feature that requires the application to query the table by using the customerId attribute.

Which solution will provide this query functionality?

Answer options

Correct answer: B

Explanation

To query a DynamoDB table using an attribute other than the existing primary key, a Global Secondary Index (GSI) must be created with customerId as its partition key. Local Secondary Indexes (LSIs) cannot be used in this scenario because they require the base table to have a composite primary key (partition and sort key) and must share the same partition key as the base table. Additionally, the primary key schema of an existing DynamoDB table cannot be altered after creation.