[DEVELOPER] SQS + SNS Flashcards
Explain how SQS Extended Client works
Say you want to send a message through SQS of 1GB. How might you do this?
SQS Extended Client
Why is SQS Long Polling preferable to Short Polling?
increases efficiency and latency of the application by decreasing number of API calls made to SQS
What are the configuration limits for wait time for SQS Long Polling?
1-20 seconds, (but 20 seconds is preferred)
What is the name API-level field for configuring SQS Long Polling?
RecieveMessageWaitTimeSeconds
What does the SQS API call PurgeQueue
do?
delete all messages in the queue
Suppose you are using an SQS/SNS fan-out pattern for an ordering service, but one of your SQS queues should only receive messages that are of the “placed” state. There are multiple SQS queues and you expect not all of your incoming messages will have a “placed” state. How can you implement this functionality?
Use SNS Message Filtering (aka fitler policies)
Suppose you want to send one S3 Event to many SQS queues. How can you do this in S3?
You cant do it in S3, because for each (event type, prefix) you can only have 1 S3 event rule
Instead Use SNS/SQS Fan-out (configure events to SNS)
Suppose you want to configure your messaging system to have ordering, deduplication, and fan-out. How can you accomplish this?
SNS FIFO Topic AND SQS FIFO Queue
Can Lambda subscribe to an SNS FIFO Queue?
NO
only SQS FIFO can subscribe to an SNS FIFO topic
What are the two methods for SQS FIFO deduplication?
- Explicit
MessageDeduplicationID
- Content-based Deduplication (a SHA-256 of the message body)
Suppose you have an SQS queue in one account and an EC2 instance in another account that needs to poll from that SQS queue. How can you configure this to happen?
Apply an SQS Queue Policy on the queue to give ReceiveMessage
permissions to the account with the EC2 instance
Suppose you want to publish an S3 event notification to an SQS queue. You check the SQS queue but the messages are not showing up there. What might you need to do?
Configure an SQS Queue Policy on the queue to give SendMessage
permissions to the S3 Bucket
Suppose you want to send one S3 Event to many SQS queues. How can you do this?
Use SNS/SQS Fan-out (configure events to SNS)
S3 Event -> SNS -(fan out) -> SQS queues
Recall: for each (event type, prefix) you can only have 1 S3 event rule