SNS vs SQS? AWS Messaging Services - Know the difference

Andrew Brown πŸ‡¨πŸ‡¦ - May 14 '19 - - Dev Community

I noticed Helen released this good DEV.to post on SNS and SQS and I happen to have a video of the same nature lying around and thought I'd upload it to provide an explanation from a different perspective.

A little bit more about Message Services

The 4 most important services you need to know when it comes to Application Integration are the following:

  • SNS - PubSub (think pass along)
  • SQS - Queueing (think batch)
  • Kinesis - Real-time
  • SWF - Queuing but with people

For the Solution Architect Associate and Certificated Cloud Practitioner you really need to know the difference between SNS and SQS.

MKS - Amazon Managed Streaming for Kafka

Most companies in BigData who want to use real-time messaging systems tend to use Kafka. Luckily AWS has a managed service called MKS (Managed Kafka Service).

Kinesis

The use case for Kinesis has been really good for gaming where you need a simple streaming queue. There is a Solutions Architect Professional exam question which asks how you would ingest millions of events from IoT game devices to then insert into a database such as DynamoDB to update a scoreboard, and so Kinesis is what you would keep in mind.

At ExamPro we built our own real-time event tracking (think GoogleAnalytics) so we can accurately track and improve how people learn on our platform.

SNS - Amazon Simple Notification Service

SNS is commonly used for sending simple internal emails. So for example when someone sign-ups on ExamPro I use the AWS SDK to send a message to an SNS topic which then sends me a plain text email.

Another way we use SNS is to trigger webhooks in your application. So for example, let us say you have a web-app which needs to extract data out of a PDF so you need to use a PDFTK which you have to run in a custom runtime in a Lambda function because of legacy reasons. When that lambda has processed that pdf you want to notify your web-app to tell the user it's done. You can have Lambda tell SNS which will then send an HTTP request to an api endpoint (webhook) to your web-app which will then update the user that the pdf has finished processing.

SQS - Amazon Simple Queue Service

When we send out an email such as confirmation or reset password on ExamPro we use SQS to decouple email sending from our app so it doesn't cause the app to hang. ExamPro is a Rails app and so this gem called Shoryuken makes it really easy to start working with SQS will little knowledge.

GitHub logo ruby-shoryuken / shoryuken

A super efficient Amazon SQS thread based message processor for Ruby

I'm looking for Shoryuken maintainers, are you interested on helping to maintain Shoryuken? Join our Slack

Shoryuken

Shoryuken

Shoryuken sho-ryu-ken is a super-efficient Amazon SQS thread-based message processor.

Build Status Code Climate

Key features

Requirements

Ruby 2.4 or greater.

Installation

Add this line to your application's Gemfile:

gem 'shoryuken'
Enter fullscreen mode Exit fullscreen mode

If you are using AWS SDK version 3, please also add this line:

gem 'aws-sdk-sqs'
Enter fullscreen mode Exit fullscreen mode

The extra gem aws-sdk-sqs is required in order to keep Shoryuken compatible with AWS SDK version 2 and 3.

And then execute:

$ bundle
Enter fullscreen mode Exit fullscreen mode

Usage

Check the Getting Started page.

More Information

For more information check the wiki page.

Credits

Mike Perham, creator of Sidekiq, and everybody who contributed to it. Shoryuken wouldn't exist as it is without those…

SWF

Nobody I know uses this service. It's used by AWS I believe to help coordinate a sequence of tasks with people and services which makes sense for Amazon when they need to have humans put things into boxes and then ship those boxes.

There isn't even a new AWS icon. I've never been able to figure out how to access this service. It shows up on exams.

Help me out make more free content

If you like this kind of AWS content the way you can help me out is adding me to Linked In and endorsing my skill for AWS. You should add me anyway I love connecting with people on DEV.to

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player