Q31 — AWS SAP-C02 Ch.2
Question 31 of 75 | ← Chapter 2
Q181. A delivery company is running a serverless solution in the AWS Cloud. The solution manages user data, delivery information, and past purchase details. The solution consists of several microservices. The central user service stores sensitive data in an Amazon DynamoDB table. Several of the other microservices store a copy of parts of the sensitive data in different storage services. The company needs the ability to delete user information upon request. As soon as the central user service deletes a user, every other microservice must also delete its copy of the data immediately. Which solution will meet these requirements?
- A. Activate DynamoDB Streams on the DynamoDB table. Create an AWS Lambda trigger for the DynamoDB stream that will post events about user deletion in an Amazon Simple Queue Service (Amazon SQS) queue. Configure each microservice to poll the queue and delete the user from the DynamoDB table
- B. Set up DynamoDB event notifications on the DynamoDB table. Create an Amazon Simple Notification Service (Amazon SNS) topic as a target for the DynamoDB event notification. Configure each microservice to subscribe to the SNS topic and to delete the user from the DynamoDB table
- C. Configure the central user service to post an event on a custom Amazon EventBridge event bus when the company deletes a user. Create an EventBridge rule for each microservice to match the user deletion event pattern and invoke logic in the microservice to delete the user from the DynamoDB table ✓
- D. Configure the central user service to post a message on an Amazon Simple Queue Service (Amazon SQS) queue when the company deletes a user. Configure each microservice to create an event filter on the SQS queue and to delete the user from the DynamoDB table
Correct Answer: C. Configure the central user service to post an event on a custom Amazon EventBridge event bus when the company deletes a user. Create an EventBridge rule for each microservice to match the user deletion event pattern and invoke logic in the microservice to delete the user from the DynamoDB table
Explanation
C is the solution that will meet the requirements. Option A involves activating DynamoDB streams and creating a Lambda trigger to post events about user deletion onto an SQS queue. Each microservice would then poll the queue and delete the user from the DynamoDB table. This option adds complexity due to the need for additional infrastructure components, which could increase operational overhead. Option B involves setting up DynamoDB event notifications and creating an SNS topic as a target for the notification. Each microservice would then subscribe to the SNS topic and delete the user from the DynamoDB table. While this option can work, it requires that each microservice subscribes to the SNS topic, which could lead to increased operational overhead. Option C involves configuring the central user service to post an event on an EventBridge event bus when the company deletes a user. Each microservice would have an EventBridge rule matching the user deletion event pattern that invokes logic to delete the user from the DynamoDB table. This option minimizes operational overhead by using a fully managed service and enables immediate deletion of user information across all microservices. Option D involves configuring the central user service to post a message on an SQS queue when the company deletes a user. Each microservice would create an event filter on the SQS queue and delete the user from the DynamoDB table. This option adds complexity due to the need for additional infrastructure components, which could increase operational overhead. Overall, option C provides a cost-effective and scalable solution for deleting user information upon request while minimizing operational overhead. SQS is one queue to one microservice, could not find anything on dynamodb event notifications. B is wrong. There is no feature named DynamoDB event notifications.