DVA-C02 practice question · Development with AWS Services
A DynamoDB PutItem call should only succeed if an item with that primary key doesn't already exist (to avoid…
A DynamoDB PutItem call should only succeed if an item with that primary key doesn't already exist (to avoid accidentally overwriting an existing item). What ConditionExpression function achieves this?
- Aattribute_not_exists(), applied to one of the item's key attributes
- Battribute_exists(), applied to the item's key attribute
- CDynamoDB has no way to conditionally prevent overwriting an existing item on PutItem
- Dbegins_with(), applied to the sort key
Show the answer and explanation
Correct answer: A) attribute_not_exists(), applied to one of the item's key attributes
Why each option is right or wrong
- A) Correct. attribute_not_exists(partitionKeyName) as a ConditionExpression makes the PutItem call fail if an item with that key already exists (since the key attribute would already be present on the existing item), which is the standard pattern for a "create only if not already present" write, preventing an accidental silent overwrite.
- B) Incorrect. This reverses the actual logic needed — attribute_exists() would require the item to ALREADY exist for the write to succeed, the opposite of the "only create if it doesn't already exist" requirement.
- C) Incorrect. attribute_not_exists() in a ConditionExpression is an explicitly supported, standard pattern for exactly this scenario — this option is factually incorrect.
- D) Incorrect. begins_with() checks whether a string attribute starts with a given substring; it doesn't check for the existence or non-existence of an item at all.
- Exam domain
- Development with AWS Services · 32% of DVA-C02
- Question type
- Multiple choice (one answer)
Related DVA-C02 questions
- A Lambda function needs to share a common logging library and a set of utility functions across multiple functions…Development with AWS Services
- A developer wants to query a DynamoDB table efficiently using an attribute that is not the table's partition key…Development with AWS Services
- An application needs to decouple a producer service from multiple independent consumer services, so that each consumer…Development with AWS Services
- Which AWS service lets you coordinate multiple Lambda functions and other AWS services into a visual, serverless…Development with AWS Services
All 67 free DVA-C02 questions by domain · 15 sample questions on one page
Practise the full DVA-C02 exam
This question is one of a small free sample from the CertRidge DVA-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.
Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.
Worth reading: DVA-C02 cheat sheet, Lambda, DynamoDB, API Gateway, IAM and Cognito, messaging, CI/CD and X-Ray in tables, plus what DVA-C03 changes.