AWS SQS, SWF & SNS

Chloe McAree
3 min readFeb 22, 2021

This is part of a blog series giving a high level overview of the different services examined on the AWS Solution Architect Associate exam, to view the whole series click here.

Simple Queue Servie (SQS) Summary

SQS Logo — https://bit.ly/37kzBGx
  • Fully managed, distributed message queue service that can be used for micro-services, distributed applications and serverless applications.
  • Can be used to decouple software components as the queues act like buffers between the component producing/saving data and the component receiving data for processing.
  • There are two types of queues: Standard & FIFO
  • SQS is PULL based e.g. you need to have EC2 pulling the messages out of the queue.
  • Messages can be in the queue for anywhere from 1 min to 14 days — default 4 days.
  • Visibility Timeout — the amount of time the message is invisible in the queue after reader picks it up. It prevents other consumers from receiving and processing the same message. The message is then deleted. If the job hasn’t completed it becomes visible in the queue again (can be max 12 hours).
  • If you are getting messages delivered twice, the cause could be your visibility timeout is too low.
  • Short Polling — Keeps polling queue looking for work, even if it’s empty. You can introduce long polling as a way of reducing costs.

Standard Queues

  • Standard queues are the default queue type.
  • Nearly unlimited number of API calls per second
  • Guarantees message delivered at least once — can be more and can be out of order occasionally

FIFO Queues

  • First in First Out
  • Has high throughput, support up to 3,000 transactions per API batch call.
  • Processed exactly once and duplicates are not introduced to the queue.
  • The order in which the messages are sent is preserved.

Simple Workflow Service (SWF) Summary

SWF logo — https://bit.ly/37mKmZ1
  • Fully managed web service for coordinating work across distributed components, basically a state and task tracker in the cloud.
  • Scales as your applications as usages increases
  • SWF can combine both digital and manual (human) tasks — an example use-case would be tracking tasks between a shopping app and its warehouse.
  • Tasks in SWF represent logical units of work and can have a retention period of up to a year.
  • Tasks are only assigned once and are never duplicated.

SWF Actors

  1. Workflow Starters→ what kicks everything off
  2. Deciders → control the flow and what to do next
  3. Activity workers → carry out the activity tasks

Simple Notification Service (SNS) Summary

SNS logo — https://bit.ly/3amoYoK
  • Fully managed messaging service that allows push notifications, SMS messages or email.
  • Allows for many-to-many messaging between distributed systems.
  • Can group recipients through topics.
  • Highly available as all messages stored across multiple regions
  • PUSH based delivery.
  • Pay as you go, no up front costs.

--

--