Skip to main content

Amazon SQS

Amazon Simple Queue Service (SQS) is a serverless message queuing system. SQS is a natural default choice for message queue integration between components in AWS thanks to low operational overhead, elastic scaling with pay-as-you-go pricing and tight integration with other AWS services such as IAM, IoT, SNS and Lambda.

SQS offers two types of message queues. Standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery. FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent, but support significantly lower throughput.

SQS is commonly used with Lambda to build elastically scaleable serverless event processing pipelines. This integration triggers a lambda function to process each individual event. Long-running consumers, on the other hand, must poll for messages as SQS does not provide a 'push' mechanism.

For more complicated scenarios, SQS works well in combination with SNS which allows 'fan out' to route messages to multiple consumers and integrates with a wider range of AWS services than SQS. SNS has a push mechanism for message consumers, avoiding the need to poll for new messages.

As compared to Kinesis, distinct features of SQS are:

  • SQS has queue semantics, as opposed to the stream model of Kinesis.
  • SQS scales smoothly and elastically, whereas Kinesis performance profile must be tuned by choosing the number of shards and partition key.
  • Kinesis can handle higher message rates while preserving FIFO ordering.