AWS Certified Developer – Associate — Question 342
A developer is creating a web application for a guitar store where customers can look for instruments in a catalog. The developer chooses Amazon DynamoDB in provisioned mode for the database. The database must contain a catalog for the instruments that are displayed in the application. The required information includes category (for example, acoustic guitar, electric guitar, bass guitar), part number, model, brand, country of fabrication, color, orientation (left-handed, right-handed), and price.
The application must give customers the ability to look for instruments by browsing category, then brand, and finally model. Customers must also be able to search by part number. Based on these requirements, the developer must choose the proper partition key, sort key, and indexes that will minimize the number of read capacity units (RCUs) that the queries consume. All query results must return all attributes.
Which combination of steps should the developer use in the table design to meet these requirements? (Choose two.)
Answer options
- A. Set part number as the partition key. Do not set a sort key.
- B. Set brand as the partition key. Set category as the sort key.
- C. Create a global secondary index (GSI) with category as the partition key and brand+model as the sort key. Select ALL for attribute projections.
- D. Create a global secondary index (GSI) with category as the partition key and brand as the sort key. Use filter expression by model when necessary. Select ALL for attribute projections.
- E. Create a global secondary index (GSI) with category+brand as the partition key and model as the sort key. Select INCLUDE for attribute projections.
Correct answer: A, D
Explanation
Setting part number as the partition key (Option A) allows direct, highly efficient lookups for specific instruments by their unique identifier. To support browsing by category, brand, and model, creating a GSI with category as the partition key and brand as the sort key (Option D) is the most efficient choice, as a filter expression can then be applied to narrow down the model. Projecting ALL attributes in this GSI prevents the database from performing expensive back-queries to the base table, thereby minimizing overall RCU consumption.