DVA-C02 practice question 24 of 35

A developer maintains a critical business application that uses Amazon DynamoDB as the primary data store The DynamoDB table contains millions of…

Full set: 598 questions

Domain Security

A developer maintains a critical business application that uses Amazon DynamoDB as the primary data store The DynamoDB table contains millions of documents and receives 30-60 requests each minute The developer needs to perform processing in near-real time on the documents when they are added or updated in the DynamoDB table How can the developer implement this feature with the LEAST amount of change to the existing application code?
Answer options
A: Set up a cron job on an Amazon EC2 instance Run a script every hour to query the table for changes and process the documents
B: Enable a DynamoDB stream on the table Invoke an AWS Lambda function to process the documents. Correct answer
C: Update the application to send a PutEvents request to Amazon EventBridge. Create an EventBridge rule to invoke an AWS Lambda function to process the documents.
D: Update the application to synchronously process the documents directly after the DynamoDB write
Correct Answer:
B. Enable a DynamoDB stream on the table Invoke an AWS Lambda function to process the documents.
Explanation

The most efficient and least intrusive way to process DynamoDB item changes in near-real time is by using DynamoDB Streams. Enabling a stream on the table captures a time-ordered sequence of all item-level modifications (creations, updates, deletions). This stream can then be configured as an event source for an AWS Lambda function. This approach is ideal because it requires no changes to the existing application code that writes to the table. The entire change detection and processing mechanism is decoupled from the primary application logic, fulfilling the core requirements of near-real-time processing with minimal application impact.

Why Incorrect

A. A cron job running hourly is a batch process, not near-real time. It would also be inefficient, requiring scans of a large table to find changes.
C. This requires modifying the application code to explicitly send an event to EventBridge after every write, violating the "least amount of change" requirement.
D. Processing documents synchronously within the application would require significant code changes and would increase the latency of the write operations, impacting application performance.

References

1. AWS DynamoDB Developer Guide

"Capturing table activity with DynamoDB Streams": "DynamoDB Streams captures a time-ordered sequence of item-level modifications in any DynamoDB table and stores this information in a log for up to 24 hours. Applications can access this log and view the data items as they appeared before and after they were modified

in near-real time." This document establishes Streams as the native

near-real-time change data capture mechanism for DynamoDB.

2. AWS Lambda Developer Guide

"Using AWS Lambda with Amazon DynamoDB": "You can use an AWS Lambda function to process records in an Amazon DynamoDB stream... Lambda reads records from the stream and invokes your function synchronously with an event that contains stream records." This confirms the direct integration pattern between DynamoDB Streams and Lambda for processing changes without modifying the client application.

3. AWS Whitepaper

"Streaming Data Solutions on AWS with Amazon Kinesis"

Page 11: While focused on Kinesis

this paper discusses change data capture (CDC) patterns. It mentions DynamoDB Streams as a prime example: "Amazon DynamoDB Streams provides a time-ordered sequence of item-level changes in any DynamoDB table... This is a powerful feature for implementing the database change data capture pattern." This reinforces the pattern's validity for the scenario.

Scroll to Top