AWS: Messaging
Services in AWS
Presenter Name:-
Kartikay Bhardwaj
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
 Punctuality
Join the session 5 minutes prior to the session start time. We start on
time and conclude on time!
 Feedback
Make sure to submit a constructive feedback for all sessions as it is very
helpful for the presenter.
 Silent Mode
Keep your mobile devices in silent mode, feel free to move out of session
in case you need to attend an urgent call.
 Avoid Disturbance
Avoid unwanted chit chat during the session.
1. Introduction
 SNS
 SQS
2. Differences
3. Use cases
4. Polling and Queue type in SQS
5. Pricing of SNS and SQS
6. Demo
Why to use Messaging Service
Messaging services are crucial in distributed systems for several reasons:
 Decoupling Components:
− Messaging services allow components to communicate without direct dependencies.
− Example: An online marketplace’s inventory management system can notify the shipping system about stock updates without tightly coupling them.
 Scalability and Load Balancing:
− Messaging services handle high message volumes efficiently.
− Example: A ride-sharing app uses messaging to distribute ride requests evenly across available drivers.
 Reliability and Fault Tolerance:
− Messaging ensures reliable delivery even if components fail temporarily.
− Example: A financial trading platform uses messaging to process orders reliably across multiple servers.
 Event-Driven Architecture:
− Messaging enables event-driven workflows.
− Example: A weather app updates users based on real-time weather events via messaging.
 Here we will explain two of the messaging service of AWS:
− SNS
− SQS
Introduction to SNS
 Amazon SNS is a fast, flexible, fully managed push
notification service that lets you send individual
messages or to bulk 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.
 SNS is a distributed publish-subscribe system.
Messages are pushed to subscribers as and when
they are sent by publishers to SNS.
 SNS supports several end points such as email, sms,
http end point and SQS. If you want unknown number
and type of subscribers to receive messages, you
need SNS.
 With Amazon SNS, you can send push 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.
Introduction to SQS
 Amazon SQS is a fully managed message queuing service
that enables you to decouple and scale microservices,
distributed systems, and serverless applications.
 SQS is distributed queuing system. Messages are not pushed
to receivers. Receivers have to poll SQS to receive messages.
Messages can be stored in SQS for short duration of time
(max 14 days).
 Messages can’t be received by multiple receivers at the same
time. Any one receiver can receive a message, process and
delete it. Other receivers do not receive the same message
later. Polling inherently introduces some latency in message
delivery in SQS unlike SNS where messages are immediately
pushed to subscribers.
Key Differences: SQS vs SNS
 Entity Type
SQS: Queue (similar to JMS, MSMQ).
SNS: Topic-Subscriber (Pub/Sub system).
 Message consumption
SQS: Pull Mechanism — Consumers poll messages from SQS.
SNS: Push Mechanism — SNS pushes messages to consumers.
 Persistence
SQS: Messages are persisted for some duration is no consumer available. The retention period value is from 1
minute to 14 days. The default is 4 days.
SNS: No persistence. Whichever consumer is present at the time of message arrival, gets the message and the
message is deleted. If no consumers available then the message is lost.
 In SQS message delivery is guaranteed but in SNS it is not.
 Consumer Type
SQS: All the consumers are supposed to be identical and hence process the messages in exact same way.
SNS: All the consumers are (supposed to be) processing the messages in different ways.
Use Cases-SNS
 You would like to be able to publish and consume batches of messages.
 You would like to allow same message to be processed in multiple ways.
 Multiple subscribers are needed. Fan-out messages to a large number of subscribers.
 You need alerting and monitoring related to applications logs, infrastructure, etc.
Use Cases-SQS
 You need a simple queue with no particular additional requirements.
 Decoupling distributed systems and allowing parallel asynchronous processing.
 Only one subscriber is needed.
 You need your messages are received sequentially and without any loss, even if some parts fail or the network
experiences disruptions.
Polling and Queue type in SQS
 Short Polling: In a short polling client requests data from the server and the server will return the response if it is available
and if it is not available then it returns an empty response.
 Long Polling: In long polling, the client sends a request to the server and if the response is not available then the server will
hold the request till the response gets available, & after the availability of the response, the server will send the response
back.
 Standard Queue:- It can handle out-of-order delivery and occasional duplicates, has high message volume and no strict ordering
requirements, provides best-effort ordering.
 FIFO Queue: It guarantees strict ordering of messages, eliminates duplicates using message deduplication, supports message grouping,
delivers a message exactly once, has throughput limitation of 300 API calls per second.
Pricing of SQS and SNS
 The first 1million request are free
Standard Queue:0.40$/Million per request
Fifi Queue: 0.50$/Million request per request
 Email:- $2/100,000Million request
 SMS:- Depend on the country
 HTTP/S:- $2/100,000 Million request
AWS: Messaging Services in AWS Presentation
AWS: Messaging Services in AWS Presentation

AWS: Messaging Services in AWS Presentation

  • 1.
    AWS: Messaging Services inAWS Presenter Name:- Kartikay Bhardwaj
  • 2.
    Lack of etiquetteand manners is a huge turn off. KnolX Etiquettes  Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time!  Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter.  Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call.  Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3.
    1. Introduction  SNS SQS 2. Differences 3. Use cases 4. Polling and Queue type in SQS 5. Pricing of SNS and SQS 6. Demo
  • 5.
    Why to useMessaging Service Messaging services are crucial in distributed systems for several reasons:  Decoupling Components: − Messaging services allow components to communicate without direct dependencies. − Example: An online marketplace’s inventory management system can notify the shipping system about stock updates without tightly coupling them.  Scalability and Load Balancing: − Messaging services handle high message volumes efficiently. − Example: A ride-sharing app uses messaging to distribute ride requests evenly across available drivers.  Reliability and Fault Tolerance: − Messaging ensures reliable delivery even if components fail temporarily. − Example: A financial trading platform uses messaging to process orders reliably across multiple servers.  Event-Driven Architecture: − Messaging enables event-driven workflows. − Example: A weather app updates users based on real-time weather events via messaging.  Here we will explain two of the messaging service of AWS: − SNS − SQS
  • 6.
    Introduction to SNS Amazon SNS is a fast, flexible, fully managed push notification service that lets you send individual messages or to bulk 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.  SNS is a distributed publish-subscribe system. Messages are pushed to subscribers as and when they are sent by publishers to SNS.  SNS supports several end points such as email, sms, http end point and SQS. If you want unknown number and type of subscribers to receive messages, you need SNS.  With Amazon SNS, you can send push 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.
  • 7.
    Introduction to SQS Amazon SQS is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.  SQS is distributed queuing system. Messages are not pushed to receivers. Receivers have to poll SQS to receive messages. Messages can be stored in SQS for short duration of time (max 14 days).  Messages can’t be received by multiple receivers at the same time. Any one receiver can receive a message, process and delete it. Other receivers do not receive the same message later. Polling inherently introduces some latency in message delivery in SQS unlike SNS where messages are immediately pushed to subscribers.
  • 9.
    Key Differences: SQSvs SNS  Entity Type SQS: Queue (similar to JMS, MSMQ). SNS: Topic-Subscriber (Pub/Sub system).  Message consumption SQS: Pull Mechanism — Consumers poll messages from SQS. SNS: Push Mechanism — SNS pushes messages to consumers.  Persistence SQS: Messages are persisted for some duration is no consumer available. The retention period value is from 1 minute to 14 days. The default is 4 days. SNS: No persistence. Whichever consumer is present at the time of message arrival, gets the message and the message is deleted. If no consumers available then the message is lost.  In SQS message delivery is guaranteed but in SNS it is not.  Consumer Type SQS: All the consumers are supposed to be identical and hence process the messages in exact same way. SNS: All the consumers are (supposed to be) processing the messages in different ways.
  • 11.
    Use Cases-SNS  Youwould like to be able to publish and consume batches of messages.  You would like to allow same message to be processed in multiple ways.  Multiple subscribers are needed. Fan-out messages to a large number of subscribers.  You need alerting and monitoring related to applications logs, infrastructure, etc.
  • 12.
    Use Cases-SQS  Youneed a simple queue with no particular additional requirements.  Decoupling distributed systems and allowing parallel asynchronous processing.  Only one subscriber is needed.  You need your messages are received sequentially and without any loss, even if some parts fail or the network experiences disruptions.
  • 13.
    Polling and Queuetype in SQS  Short Polling: In a short polling client requests data from the server and the server will return the response if it is available and if it is not available then it returns an empty response.  Long Polling: In long polling, the client sends a request to the server and if the response is not available then the server will hold the request till the response gets available, & after the availability of the response, the server will send the response back.  Standard Queue:- It can handle out-of-order delivery and occasional duplicates, has high message volume and no strict ordering requirements, provides best-effort ordering.  FIFO Queue: It guarantees strict ordering of messages, eliminates duplicates using message deduplication, supports message grouping, delivers a message exactly once, has throughput limitation of 300 API calls per second.
  • 14.
    Pricing of SQSand SNS  The first 1million request are free Standard Queue:0.40$/Million per request Fifi Queue: 0.50$/Million request per request  Email:- $2/100,000Million request  SMS:- Depend on the country  HTTP/S:- $2/100,000 Million request