How can the developer implement this feature with the LEAST amount of change to the existing application code?
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.
Enable a DynamoDB stream on the table. Invoke an AWS Lambda function to process the documents.
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.
Update the application to synchronously process the documents directly after the DynamoDB write.
Explanations:
Setting up a cron job on an EC2 instance to query the table every hour introduces latency and does not provide near-real-time processing. It also adds unnecessary operational overhead and complexity.
Enabling a DynamoDB stream allows real-time processing of document changes as they occur. AWS Lambda can be invoked automatically to process these changes, requiring minimal changes to the existing application code.
While sending events to Amazon EventBridge can facilitate processing, it requires modifying the existing application to include PutEvents requests, which increases code complexity compared to using DynamoDB streams with Lambda.
Synchronously processing documents after each write would significantly increase response times for the application, potentially leading to performance issues. This approach does not provide the desired near-real-time processing without affecting the user experience.