Soru

Zorluk: OrtaData Store Operations with Amazon DynamoDB

A developer is designing a classroom reservation system. The reservation records are stored in an Amazon DynamoDB table. The application needs to support queries to retrieve reservations for a specific classroom by date. To optimize performance and control cost, the developer must select the appropriate key schema and query strategy.

Which design option represents the most efficient and standard-compliant configuration for this requirement?

  1. A
    Design the table with ClassroomID as the partition key, invoke the Scan action using a filter expression to locate specific dates, and authenticate via the default credential provider chain.
  2. Design the table with ClassroomID as the partition key and ReservationDate as the sort key, and invoke the Query action with a key condition expression while authenticating via the default credential provider chain.Cevap
  3. C
    Design the table with ClassroomID as the partition key and ReservationDate as the sort key, invoke the Query action, and initialize the SDK client with hardcoded AWS access keys inside the application code.
  4. D
    Design the table with a single static partition key for all records, and resolve the resulting ProvisionedThroughputExceededException errors by scaling up the table's provisioned Read Capacity Units (RCUs).

Cevap

Design the table with ClassroomID as the partition key and ReservationDate as the sort key, and invoke the Query action with a key condition expression while authenticating via the default credential provider chain.
Designing the table with ClassroomID as the partition key and ReservationDate as the sort key allows the application to perform highly efficient Query operations. Querying with a key condition expression avoids scanning the entire table, minimizing consumed Read Capacity Units (RCUs) and latency. Authenticating via the default credential provider chain is the AWS-recommended security best practice as it avoids hardcoding credentials.

Adım Adım Çözüm

1
Analyze the query pattern to determine the partition key and sort key.
The application retrieves reservations for a specific classroom by date, which maps to ClassroomID as the partition key (equality comparison) and ReservationDate as the sort key (comparison/range filter).
This key schema enables targeted lookups instead of scanning the entire database.
2
Evaluate the read API options (Query vs Scan).
Query retrieves only the items that match the key condition, whereas Scan reads every item in the table.
Query is much more cost-effective and performs faster than Scan.
3
Determine the secure authentication method for the AWS SDK client.
The default credential provider chain automatically retrieves credentials from the environment, ECS task role, or EC2 instance profile, avoiding hardcoded keys.
This follows AWS security best practices and prevents credential exposure.

Anahtar Kavram

Selecting the correct DynamoDB key schema and read API operation (Query vs Scan) while maintaining secure AWS SDK authentication.
Bu soruyu puanla