AWS DynamoDB: Immediate Application Updates upon Item Modification - SAA-C03 Exam Question

Synchronize DynamoDB Modifications with Associated Application | AWS SAA-C03

Prev Question Next Question

Question

A company has set up an application in AWS that interacts with DynamoDB.

It is required that when an item is modified in a DynamoDB table, immediate entry is made to the associating application.

How can this be accomplished? (SELECT TWO.)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - C and D.

When you enable DynamoDB Streams on a table, you can associate the stream ARN with a Lambda function that you write.

Immediately after an item in the table is modified, a new record appears in the table's stream.

AWS Lambda polls the stream and invokes your Lambda function synchronously when it detects new stream records.

Since we require an immediate entry made to an application in case an item in the DynamoDB table is modified, a lambda function is also required.

Let us try to analyze this with an example:

Consider a mobile gaming app that writes to a GamesScores table.

Whenever the top score of the Game Scores table is updated, a corresponding stream record is written to the table's stream.

This event could trigger a Lambda function that posts a Congratulatory message on a Social media network handle.

DynamoDB streams can be used to monitor the changes to a DynamoDB table.

AWS Documentation mentions the following:

A DynamoDB stream is an ordered flow of information about changes to items in an Amazon DynamoDB table.

When you enable a stream on a table, DynamoDB captures information about every modification to data items in the table.

For more information on DynamoDB streams, please refer to the URL below:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html

Note:

DynamoDB is integrated with Lambda so that you can create triggers to events in DynamoDB Streams.

If you enable DynamoDB Streams on a table, you can associate the stream ARN with a Lambda function that you write.

Immediately after an item in the table is modified, a new record appears in the table's stream.

AWS Lambda polls the stream and invokes your Lambda function synchronously when it detects new stream records.

Since our requirement states that an item modified in a DynamoDB table causes an immediate entry to an associating application, a lambda function is also required.

For more information on DynamoDB streams Lambda, please refer to the URL below.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.Lambda.html

The requirement is to have an immediate entry made to the associated application whenever an item is modified in a DynamoDB table. To achieve this, we can use DynamoDB streams and AWS Lambda or CloudWatch Events.

DynamoDB Streams is a feature of DynamoDB that provides a time-ordered sequence of item-level changes made to a table. It captures the modification events and stores them in a log in near real-time, making it easier to capture, process, and act upon the data.

Here are the two solutions that fulfill the requirement:

  1. Set up CloudWatch to monitor the DynamoDB table for changes. Then trigger a Lambda function to send the changes to the application.

This solution involves setting up a CloudWatch Events rule that triggers a Lambda function whenever a modification is made to the DynamoDB table. The Lambda function can then send the changes to the associated application using an API call or another method.

To implement this solution, follow these steps:

  1. Create a new Lambda function that will process the events from the DynamoDB stream and send them to the application.

  2. Create a new CloudWatch Events rule that will trigger the Lambda function whenever a modification is made to the DynamoDB table.

  3. Configure the Lambda function to process the events from the DynamoDB stream and send them to the application.

  4. Use DynamoDB streams to monitor the changes to the DynamoDB table. Trigger a lambda function to make an associated entry in the application as soon as the DynamoDB streams are modified.

This solution involves using DynamoDB streams to monitor the changes made to the DynamoDB table. Whenever a modification is made, the stream sends the event to a Lambda function that processes the changes and sends them to the associated application.

To implement this solution, follow these steps:

  1. Enable DynamoDB streams on the table that needs to be monitored.
  2. Create a new Lambda function that will process the events from the DynamoDB stream and send them to the application.
  3. Configure the Lambda function to process the events from the DynamoDB stream and send them to the application.

In conclusion, both solutions use DynamoDB streams and AWS Lambda to capture the modification events and send them to the associated application. The difference is in the trigger mechanism - one uses CloudWatch Events to trigger the Lambda function, while the other uses DynamoDB streams directly to trigger the Lambda function.