Courseiva

DVA-C02 Development with AWS Services Practice Question

Network Topology
aws dynamodb querytable-name Orderskey-condition-expression "OrderID = :id"Refer to the exhibit.

A developer runs the following AWS CLI query against a DynamoDB table named 'Orders' and receives a ValidationException:

```

aws dynamodb query \

--table-name Orders \ --key-condition-expression "OrderID = :orderID" \ --expression-attribute-values '{":orderID":{"S":"12345"}}' ```

What is the MOST likely cause?

⚠ Common exam trap

Many candidates assume the error is due to missing a sort key or incorrect value formatting, but DynamoDB's strict schema validation means the partition key name must exactly match the table's definition, which is a common oversight.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The table's partition key is not named 'OrderID'

DynamoDB's Query operation requires that the KeyConditionExpression reference the table's actual partition key name exactly. If the Orders table's partition key is not named 'OrderID', the query fails with a ValidationException. The expression attribute values are formatted correctly, and a sort key is not required to query by partition key alone.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    The expression attribute values are incorrectly formatted

    Why it's wrong here

    The provided ExpressionAttributeValues format, ":orderId": {"S": "A123"}, is syntactically correct for specifying a string attribute value within a DynamoDB operation. In DynamoDB API calls, attribute values are represented as maps where the key indicates the data type (e.g., "S" for string, "N" for number, "BOOL" for boolean) and the value is the actual data. Therefore, the formatting itself is not the source of an error related to key conditions.

  • ✓

    The table's partition key is not named 'OrderID'

    Why this is correct

    A DynamoDB Query operation fundamentally requires that its KeyConditionExpression explicitly references the table's defined partition key attribute. If the table's actual partition key is named something other than 'OrderID' (e.g., 'CustomerID' or 'PK'), then attempting to use 'OrderID' in the KeyConditionExpression will result in a ValidationException. This error occurs because the query is trying to apply a key condition to an attribute that is not recognized as the table's primary partition key.

  • ✗

    The table does not exist

    Why it's wrong here

    If the specified DynamoDB table did not exist, the API call would typically return a ResourceNotFoundException. This error explicitly indicates that the table name provided in the request cannot be found in the AWS account and region. The context of the problem, which points towards an issue with the KeyConditionExpression not matching the table's schema, suggests that the table itself does exist, but the query parameters are misaligned with its definition.

  • ✗

    The query needs to use a sort key

    Why it's wrong here

    While a DynamoDB table can optionally have a sort key in addition to its partition key, a Query operation does not strictly require the sort key to be included in the KeyConditionExpression. A query must specify the partition key, but it can retrieve all items associated with that partition key without further filtering by the sort key. Including the sort key is only necessary if you want to narrow down the results to a specific range or value within that partition.

About these practice questions

This DVA-C02 question is part of Courseiva's 1,135-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.