A developer is implementing a messaging solution for a retail checkout application. When a purchase is completed, an event must be sent to an Amazon SNS topic and fanned out to two Amazon SQS queues: one for shipping logistics and one for customer notifications.
Which of the following actions must the developer take to ensure that messages published to the SNS topic are successfully delivered to both SQS queues? (Select TWO.)
- Subscribe both SQS queues to the SNS topic.Answer
- Configure the SQS queue access policy for both queues to grant the 'sqs:SendMessage' permission to the SNS topic principal.Answer
- CConfigure the SQS queue visibility timeout to be shorter than the SNS message retention period to accelerate message routing.
- DAdd an IAM trust policy to the SNS topic that allows the SQS queues to assume the SNS topic's IAM service role.
- EInitialize the SNS client inside the application by hardcoding an IAM user's secret access key that has full SQS permissions.
Answer
To successfully fan out messages from an Amazon SNS topic to Amazon SQS queues, the developer must subscribe the SQS queues to the SNS topic and grant the SNS topic permission to send messages by updating the SQS queue access policies.
The correct options are to subscribe both SQS queues to the SNS topic and to configure the SQS queue access policies to grant the SNS topic principal the 'sqs:SendMessage' permission. This allows the SNS topic to successfully push messages to the SQS queues.
Step-by-Step Solution
Key Concept
Amazon SNS-to-SQS fanout requires subscribing the queues to the topic and configuring the SQS queue access policies to allow the SNS topic to write to the queues.