[comment]: # (mdslides presentation.md --include media) [comment]: # (The list of themes is at https://revealjs.com/themes/) [comment]: # (The list of code themes is at https://highlightjs.org/) [comment]: # (markdown: { smartypants: true })
DevOpsTheHardWay
These are the slides we use in class, you're welcome to explore them. Enjoy your learning journey!
# Simple Queue Service and Simple Notification Service  By Alon Itach
### Today's agenda - Introducing Simple Queue Service and Simple Notification Service. - The Producer - consumer model - The Publisher - subscriber model
### Amazon SQS - SQS offers a hosted **message brokers system** that lets you integrate and decouple distributed software systems and components - In microservices architecture style, each service run in a unique process and need to communicate with other services - Services can communicate via request/response based communication, but asynchronous communication mechanisms based around messages is widely adopted. - SQS supports both [standard](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/standard-queues.html) and [FIFO](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html) queues. - You pay based on the number and content of requests (first monthly 1M requests are free)
### Basic Architecture - There are three main parts in a distributed messaging system: - The components of your distributed system - Your queue - The messages in the queue - **Producers** are components that send messages to the queue. - **Consumers** are components that receive messages from the queue. - In the below diagram, the queue holds messages A through E (redundantly stores across multiple SQS servers)
### Basic Architecture In the below diagram, the queue holds messages A through E (**redundantly** stores across multiple SQS servers) 
### Message lifecycle The following scenario describes the lifecycle of a message in a queue, from creation to deletion.  1. Component 1 sends msg A to a queue.
### Message lifecycle The following scenario describes the lifecycle of a message in a queue, from creation to deletion.  2. When component 2 is ready to process messages, it consumes messages from the queue, and message A is returned.
### Message lifecycle The following scenario describes the lifecycle of a message in a queue, from creation to deletion.  3. Component 2 deletes message A from the queue to prevent the message from being received and processed again when the visibility timeout expires.
### Queue types - [Standard queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/standard-queues.html) support a nearly unlimited number of API calls per second (SendMessage, ReceiveMessage, or DeleteMessage), at-least-once message delivery (which means that more than one copy of a message might be delivered). Standard queues provide best-effort ordering. - [FIFO](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html) (First-In-First-Out) queues are designed to enhance messaging between applications when the order of operations and events is critical. FIFO queues provide exactly-once processing but have a limited number of transactions per second (TPS) - [Dead-letter queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) (DLQ) can receive messages from other queues that can't be processed (consumed) successfully - [Delay queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html) let you postpone the delivery of new messages to consumers for a number of seconds
### Amazon SNS - SNS is a managed service that provides message delivery from publishers to subscribers. - Publishers communicate asynchronously with subscribers by sending messages to a topic. - Each subscriber receives every message published to the topic. - Reach supported endpoint types: - Phone push notifications - SMS - mailing list - SQS - Lambda - HTTP etc..
### Amazon SNS 
### SNS Features and Capabilities - Standard and FIFO topics. - Message durability - If a subscribed endpoint isn't available SNS runs a [delivery retry policy](https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html). - By default, each subscriber receives every message published to the topic, by a subset of the messages can be [filtered by policy](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html). - Messages are encrypted both [at rest and transit](https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html).
# Thanks