A developer is building a backend service for a food delivery application. The service needs to store and query customer order history in an Amazon DynamoDB table. The table is structured with `CustomerId` as the partition key and `OrderTimestamp` as the sort key. The developer also needs to perform bulk updates of restaurant menus daily, uploading up to menu items. The developer wants to optimize application performance, minimize DynamoDB capacity consumption, and ensure secure credential management.
Which two strategies should the developer implement? (Select two.)
- Use the `Query` API operation with the `CustomerId` and a key condition expression on `OrderTimestamp` to retrieve a customer's order history.Cevap
- Use the `BatchWriteItem` API operation to perform the bulk menu updates, grouping the write requests in batches of up to items.Cevap
- CUse the `Scan` API operation with a `FilterExpression` on `CustomerId` and `OrderTimestamp` to locate and retrieve the customer's orders.
- DEmbed the AWS access key and secret access key directly in the application configuration to initialize the DynamoDB client.
- EIncrease the table's provisioned write capacity units (WCUs) immediately if `ProvisionedThroughputExceededException` errors occur during bulk updates, without analyzing partition key distribution.
Cevap
The developer should use the Query API operation to retrieve a customer's order history and the BatchWriteItem API operation to perform the bulk menu updates.
The correct strategies are to use the Query API for order retrieval and the BatchWriteItem API for bulk menu updates. Using Query targets the specific partition key directly, optimizing read performance. Using BatchWriteItem bundles multiple write requests into a single network round trip, reducing API overhead.
Adım Adım Çözüm
Anahtar Kavram
Efficient DynamoDB retrieval using Query rather than Scan, batching writes using BatchWriteItem, and adhering to AWS credential and partition scaling best practices.