Question 1
Topic: Development with AWS Services
Skill tested: Selects DynamoDB write patterns that preserve idempotency during retried Lambda invocations.
A ticketing service receives payment-provider callbacks through an AWS Lambda function. The provider retries a callback when it does not receive a timely response, so the same event can reach the function more than once. The application stores ticket status in a DynamoDB table, and each callback includes a unique event ID. The function must not apply the same status transition twice, and the team wants to avoid a separate read before every write. Which approach best meets these requirements?
A conditional write makes the idempotency check and state change atomic at DynamoDB, so concurrent or retried deliveries cannot both apply the same event. The function can interpret a conditional-check failure as an already-processed event. An unconditional PutItem can overwrite prior state, while a read followed by an unconditional update has a race between those operations. Reserved concurrency limits parallelism but does not prevent later retries from applying the event again.