First, SNS = simple Notification Service,sqs = simple Queue Service
What is the difference between SNS and SQS?
(REF:HTTPS://STACKOVERFLOW.COM/QUESTIONS/13681213/WHAT-IS-THE-DIFFERENCE-BETWEEN-AMAZON-SNS-AND-AMAZON-SQS)
SNS is a distributed publish-subscribe system, and once publisher publishes it, subscriber can receive it immediately .
The SNS Subscriber (end point) can be mail, SMS, or even SQS, typically used in cases where the number of subscriber is unknown
SQS is a distributed queue system, and message is not pushed to Subscriber by default.
Subscriber gets a message that needs to be polled (polling).
Once a subscriber receives, processes, or deletes this message, the other Subscribers will not receive the same message.
How to use SNS? (ref:https://gist.github.com/stuartmyles/8099723)
Make sure that the goal of Publisher and Subscriber is the same topic when you ensure that AWS keys are aligned correctly
How do I use SQS? (ref:https://aws.amazon.com/cn/blogs/developer/using-python-and-amazon-sqs-fifo-queues-to-preserve-message-sequencing/)
Use SQS to create (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ sqs-getting-started.html), you need to ensure that AWS Key is exactly the same as the sender key, andQueueName is consistent
You can also let SNS act as publisher and receive it with SQS. In this case, you need to use the set_attributes method (ref:https://aws.amazon.com/cn/blogs/developer/ subscribing-an-sqs-queue-to-an-sns-topic/, https://docs.aws.amazon.com/sns/latest/dg/SendMessageToSQS.html)
Using AWS SNS and SQS in Python