Question

Difficulty: HardData Store Operations with Amazon DynamoDB

A developer is designing a fleet management system that tracks delivery drone telemetry. Telemetry data is ingested into an Amazon DynamoDB table with the following schema:

* Base Table: `DroneTelemetry`
* Partition Key: `DroneID` (String)
* Sort Key: `ReadingTimestamp` (Number, Unix epoch time)
* Attributes: `BatteryLevel` (Number), `Latitude` (Number), `Longitude` (Number), `Status` (String)

The developer needs to implement the following requirements:
1. Retrieve all telemetry data for a specific drone within the last 33 hours to plot its flight path.
2. Periodically identify drones that currently have a `Status` of `'Critical'` across the entire fleet.

Which two strategies should the developer implement to meet these requirements with optimal performance and minimum Read Capacity Unit (RCU) consumption? (Choose two.)

  1. Perform a Query operation on the base table using a key condition expression specifying the DroneID and a range condition on the ReadingTimestamp.Answer
  2. Create a Global Secondary Index (GSI) with Status as the partition key and ReadingTimestamp as the sort key, then perform a Query operation on the GSI.Answer
  3. C
    Perform a Scan operation on the base table using a FilterExpression to retrieve telemetry records where the status is 'Critical'.
  4. D
    Increase the provisioned read capacity units (RCUs) on the base table to resolve ProvisionedThroughputExceededException throttling errors.
  5. E
    Initialize the AWS SDK client in the application by hardcoding the IAM access key ID and secret access key directly in the initialization code.

Answer

The correct strategy is to perform a Query operation on the base table using a key condition expression specifying the DroneID and a range condition on the ReadingTimestamp to fetch the drone's telemetry, and to create a Global Secondary Index (GSI) with Status as the partition key to perform a Query operation to retrieve drones with a critical status.
The correct strategy combines a direct Query operation on the base table with a GSI-based Query. A base table Query is optimal because it specifies the exact partition key (DroneID) and filters using the sort key (ReadingTimestamp). For the status check, a GSI with Status as the partition key allows the application to query only the matching records, which eliminates the need to scan the entire dataset and saves substantial read capacity.

Step-by-Step Solution

1
Analyze the query requirement for drone flight paths.
The query targets a specific partition key (DroneID) and a range of the sort key (ReadingTimestamp).
Performing a Query operation on the base table directly uses the primary key attributes, which returns matches efficiently without scanning irrelevant data.
2
Analyze the query requirement for identifying critical drones.
Since the status attribute is not part of the primary key of the base table, a GSI is required to avoid a Scan operation.
Creating a GSI with Status as the partition key enables querying the status attribute directly, which restricts the scanned items only to those matching the partition key value.
3
Evaluate and eliminate incorrect approaches.
Identify Scan operations, incorrect scaling solutions, and security violations.
Scan operations read the entire table and waste read capacity. Scaling provisioned throughput does not fix hot partition throttling. Hardcoding credentials violates security best practices.

Key Concept

Optimizing read operations in DynamoDB using base table Query operations and Global Secondary Indexes (GSIs) to avoid costly Scan operations.
Rate this question