AWS SQS: Part 1 – Introduction for Developers and Architects

By | February 5, 2024

Amazon SQS, Simple Queue Service, is a fully managed message queuing service from Amazon that stands as a cornerstone when implementing inter-component messaging in microservices, distributed, and serverless function-based systems.

(This post was originally here, but I have moved it out to its own page and for clarity and I’ve added more infomation)

(Don’t miss the in-depth exploration in “Amazon SQS: Part 2 – When to use AWS SQS,” where I examine the pivotal role of AWS SQS across multiple scenarios such as order processing, microservices communication, and handling traffic surges. The piece contrasts SQS’s functionalities with other AWS services, guiding you on when to employ each for a streamlined, scalable serverless architecture.)

Application Collaboration:

SQS introduces an asynchronous point-to-point communication model between two components. When components communicate via SQS, the producer component sends messages to the queue without needing to know about the consumer’s state or even its existence.

Consumers of a queue poll over HTTPS and pull/fetch messages from the queue when it’s ready to process them. This pull model allows for efficient message retrieval without the overhead of constant connection maintenance.

Message Lifecycle:

  • Message Retention: In SQS, messages are stored until they’re processed or until the message retention period expires. This period can be configured from 1 minute to 14 days, with the default being 4 days.
  • Visibility Timeout: After a consumer pulls a message, it’s invisible to other consumers for the duration of the visibility timeout. If it’s not deleted within this period, it becomes visible again, preventing message loss in case of processing failures.
  • Message Removal: Once a message is successfully processed, it must be explicitly deleted from the queue by the consumer. If not deleted, the message becomes visible again after the “visibility timeout” period expires. This mechanism helps in ensuring that no message is lost in case of processing failures.

Because of the message lifecycle of SQS, each queue can only have one consumer, depending on the queue type of course the consumer can be scaled and have the queue load balance the messages between processor instances.

Type of Queues

Amazon SQS offer two types of queues:

  • Standard Queues
  • FIFO Queues

The Key Differences are:

Order Preservation:

  • FIFO queues preserve the exact order of messages; only one consumer can process messages at a time in the order they are sent.
  • Standard queues do not ensure strict order and multiple consumers can process messages simultaneously, potentially leading to out-of-order processing.


  • Standard queues provide a higher throughput compared to FIFO queues.
  • FIFO queues are designed to ensure the order and uniqueness of messages, which can limit the rate at which messages are sent and processed.

Message Delivery:

  • Standard queues provide at least-once-delivery, meaning messages might occasionally be delivered more than once.
  • FIFO queues provide exact-once processing, ensuring each message is delivered once and remains available until a consumer processes and deletes it.

Comprehensive Overview of Amazon SQS Features and Benefits:

  1. High Throughput and Scalable Workload Management: SQS excels in handling a nearly unlimited number of messages and API calls per second (‘SendMessage’, ‘ReceiveMessage’, and ‘DeleteMessage’). Its ability to scale automatically and process each buffered request independently ensures that the system can manage load increases or spikes smoothly, providing robust support for high-volume messaging scenarios.
  2. Enhanced System Reliability: By locking messages during processing, SQS ensures that multiple producers and consumers can operate simultaneously without message loss. Standard queues deliver messages at least once, while FIFO queues maintain strict order and guarantee exactly-once processing, enhancing operations’ overall reliability and integrity.
  3. Controlled Message Delivery and Timing: With features like Delay Queues, which enable delaying processing of all messages in a queue for a certain period of time, avliable for both standard and FIFO queues and the ablity when using a standard queue to set individual Message Timers per message, SQS allows you to fine-tune message delivery schedules.
  4. Optimized Message Retrieval and Processing: Long Polling and Batch Operations optimize the retrieval and processing of messages, minimizing unnecessary API calls and ensuring efficient communication between producers and consumers.
  5. Advanced Message Management and Customization: SQS supports unlimited queues and messages, and you can enrich messages with structured metadata. Customize queue behaviour to fit specific needs, such as integrating with Amazon S3 or Amazon DynamoDB for more significant messages, ensuring efficient handling of diverse message types and sizes.
  6. Robust Security and Access Management: With server-side encryption (SSE) and comprehensive IAM policies, SQS ensures that your message data remains secure and that only authorized entities can access your queues, maintaining the integrity and confidentiality of your communication channels.
  7. Guaranteed Message Durability and High Availability: Messages are redundantly stored across multiple servers and data centres, ensuring their durability and availability. SQS’s infrastructure is designed to provide high availability and reliability for both message production and consumption, even during unexpected traffic spikes or component failures.
  8. Seamless Integration with AWS Ecosystem: Leverage the power of AWS services by integrating SQS with AWS Lambda, Amazon SNS, and Amazon EC2, among others, to create flexible, scalable, and resilient applications that meet your evolving business needs.
  9. Workload Absorption During Traffic Spikes: SQS’s remarkable capacity to absorb workload spikes acts as a buffer, storing messages when traffic surges or when consumers are unavailable or slow in processing messages. This ensures producers can continue their operations seamlessly, maintaining system performance and responsiveness.


Amazon SQS emerges as a robust messaging solution within the AWS ecosystem, characterized by its exceptional scalability, reliability, and adaptability. It’s designed to facilitate secure, efficient, and seamless message handling, empowering your architecture to navigate and excel in the ever-evolving cloud computing landscape. SQS provides a broad feature set that fortifies your system’s communication, ensuring it remains robust, responsive, and adaptable.

However, it’s essential to acknowledge and address the potential drawbacks associated with SQS to leverage its capabilities fully:

  1. Latency Considerations: The inherent pull-based model of SQS might introduce latency due to the need for consumers to poll the queue for new messages actively. This aspect requires careful management of polling strategies to maintain system responsiveness.
  2. Message Ordering Complexity: While FIFO queues offer strict message ordering, Standard queues do not guarantee the exact sequence of message delivery. Applications may need additional mechanisms or logic to handle potential out-of-order messages, especially when order is paramount.
  3. Polling Costs: Depending on the polling method employed, particularly with long polling, cost implications might be related to the number of API requests made or the time spent waiting for messages to arrive in the queue.
  4. Queue Message Retention Because it is a queue it has the retention of one; once messages are deleted by processors or messages exceed the retention period set or the max 14 days, messages are deleted forever.

In conclusion, while Amazon SQS provides a robust framework for message queuing, ensuring a loosely coupled and highly scalable communication environment, it’s imperative to carefully evaluate and manage aspects like latency, message ordering, polling costs and message retention. By doing so, you can harness the full potential of SQS, enhancing the fault tolerance, resilience, and overall effectiveness of your system’s messaging capabilities.

Leave a Reply