What is the difference between Amazon SNS and Amazon SQS?

I've an AWS CSA Professional Level exam scheduled for 27th and someone told me that there will be lot of questions from SQS/SWF. I'm going through the AWS FAQs/Documentations and trying my level best to understand.

Although, to some extent I understood but I again get lost very soon in my head when I try to compare the difference and use case scenarios of these services. May be because I'm not from the developer background. :(

Could someone please help me in understanding, when one would use SNS versus SQS, and why are they always coupled together?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
huge differences
Amazon Simple Notification Service (Amazon SNS) is a fast, flexible, fully managed push notification service that lets you send individual messages or to fan-out messages to large numbers of recipients. Amazon SNS makes it simple and cost effective to send push notifications to mobile device users, email recipients or even send messages to other distributed services.

With Amazon SNS, you can send notifications to Apple, Google, Fire OS, and Windows devices, as well as to Android devices in China with Baidu Cloud Push. You can use SNS to send SMS messages to mobile device users in the US or to email recipients worldwide.

Beyond these endpoints, Amazon SNS can also deliver messages to Amazon Simple Queue Service (SQS)

Amazon Simple Queue Service (SQS) is a fast, reliable, scalable, fully managed message queuing service. SQS makes it simple and cost-effective to decouple the components of a cloud application. You can use SQS to transmit any volume of data, at any level of throughput, without losing messages or requiring other services to be always available.

With SQS, you can offload the administrative burden of operating and scaling a highly available messaging cluster, while paying a low price for only what you use.

what don't you understand?
cloudtechnicianAuthor Commented:
Thanks David for the comment. I'm sorry, it was actually about the difference between SQS and SWF.
btanExec ConsultantCommented:
Basically, to implement something like push notification messages, it is recommended to use SNS messages and the SQS queues. Overall, just see them as the SNS messages are push into a SQS queue and stored until someone retrieve them from the queue, or takes them out of the queue (and delete) or the queue retention time expires. I tend to see it SNS analogous to the concept of Passenger/Passport and SQS is like the Travelator (moving walkway) queue (just that it is the static type when people move than it starts to move ...)..

Sort of an interim repository "safeguard" to ensure such message queuing scheme can be resilient for services not to lose message (unless reached queue size) and recover to the last message queued to be retrieved. The network tends to be full of unexpected capacity and for a better assurance this scheme may helps but can be slower since it is queue and retrieve approach as compared to "live" streaming (that easily flood the recipient) or push out broadcast that just send w/o user even been ready to take in or busy...

SNS/SQS both together will then function effectively and you can even have as many subscribers as you want for SNS. Then have notifications sent to multiple SQS queues. It scales up with more users and services. Do see the common scenario to aid understanding too...

Also do not mix Apples APNS with AWS SNS/SQS. Most thought they are same but it is not. In fact you can use AWS SNS to push into APNS services (that acts like the "queue" in place of SQS). Overall, in order for SNS to communicate with the different push notification services, you submit your push notification service credentials to SNS to be used on your behalf.
btanExec ConsultantCommented:
SNS/SQS set the baseline understanding then since that is not what you are seeking. SWF is really for developer and you needed more granular control and a workflow rather then just happy with a push and queue scheme that acts as enabler to broadcast messages. The workflow is the key difference and missing from SQS.

For example, the workflow can be more than just pushing a message into SQS, you could using SWF
•Send to SNS, to trigger an AWS function (customized services to work on some tasks..) or
•Trigger an AWS function (as instructed or scheduled task) directly, or
•Upload to AWS S3 instance at all times, or
•Rethink why you are creating such a file in Amazon S3 and potentially use a database instead

It caters more condition for action to be taken in accordance what you want it to be unlike SQS can be restricted to queue which is waiting while SWF may act decisively based on intelligence of request or type of services...likewise, you can create a job that kicks off the SWF when the SQS queue gets a message. In short, SWF give you control and flexibility provided SNS/SQS cannot fulfill what you need or you wanted more ...some explore into function such as stated in the AWS provided capability - https://aws.amazon.com/about-aws/whats-new/2015/08/trigger-aws-lambda-functions-using-amazon-simple-workflow/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.