Amazon Simple Queue Service (SQS)

What is Amazon Simple Queue Service (SQS)?

Amazon Simple Queue Service (SQS) is a managed message queuing service technical professionals and developers use to send, store and retrieve multiple messages of various sizes asynchronously.

The service enables users to decouple individual microservices, distributed systems and serverless applications from one another and to scale them without requiring the user to establish and maintain their own message queues.

How is Amazon SQS used?

Developers can use Amazon SQS to safely exchange messages between different software components. Amazon SQS provides a standard web services application program interface that users can access via common programming languages.

Amazon SQS supports tasks that process asynchronously. This means that rather than a single application needing to invoke another one directly, the app can simply send a message into a queue, where it waits. Other applications can then access the message later.

There are two types of Amazon SQS queues: first-in, first-out (FIFO) and standard queues. In FIFO queues, message strings remain in the same order in which the original messages were sent and received. FIFO queues support up to 300 send, receive or delete messages per second. FIFO queues are designed for messaging between applications where the order of operations and events is critical.

Standard queues attempt to keep message strings in the same order in which the messages were originally sent, but processing requirements may change the original order or sequence of messages. For example, standard queues can be used to batch messages for future processing or allocate tasks to multiple worker nodes.

The frequency of message delivery differs between standard and FIFO queues, as FIFO messages are delivered exactly once, while in standard queues, messages are delivered at least once.

What advantages does Amazon SQS have over other message queuing systems?

Building software to manage message queues requires advanced development skills. Although there are prepackaged options available, they may require upfront development and configuration. These alternatives also require a continual investment in hardware maintenance and system administration resources, as well as redundant storage in the event of hardware failure. Amazon SQS enables users to sidestep such issues, as it eliminates the additional time and resource requirements.

Amazon SQS delivers high-performance standards due to its ability to decouple the various components of each application. Each component runs independently of others -- and also fails independently. This increases the system's overall stability and fault tolerance.

Amazon SQS queues do not have to be the same. For example, a user can set a default delay on a particular queue. There are also options that enable users to store the contents of messages above a certain size using Amazon Simple Storage Service or Amazon DynamoDB. Larger messages can also be split into a series of smaller ones.

How long can messages in Amazon SQS message queues be kept?

Amazon SQS messages can be kept for an extended period. This provides longer intervals between the time messages are produced and when they are ultimately picked up in the queue and consumed.

Amazon SQS' message retention period can be set from one minute to 14 days. The system's default setting is four days. Messages are automatically deleted once the message retention quota has been reached.

What are the size limits on Amazon SQS message queues?

There is no limit on the number of messages that any individual Amazon SQS message queue can contain. But the system has different quotas for inflight messages for its two different queue types. A message is considered inflight once a consuming component has received it from the queue, but it has not yet been erased from the queue. Amazon SQS allows 120,000 inflight messages in standard queues and 20,000 for messages in FIFO queues. There is no limit to the number of message queues a user can create, but the name of the message queue can be no longer than 80 characters.

A message queue's name must be exclusive within a particular Amazon Web Services (AWS) account and region. But once a user deletes a message queue, they can reuse its name.

Amazon SQS message security and compliance

Developers can use server-side encryption to safely send and receive confidential or sensitive data between applications. AWS Key Management Service keeps a record of every time encryption keys are used and logs this in AWS CloudTrail. This helps ensure the user remains compliant with data management regulations.

Amazon SQS pricing

Amazon SQS does not require any upfront cost, and there is no need to buy, deploy, build or maintain any supporting infrastructure. Amazon SQS' pricing structure is usage-based, which can help provide substantial cost savings over self-managed messaging middleware alternatives available on the market that have always-on pricing.

The AWS Free Tier enables Amazon SQS users to make up to 1 million Amazon SQS requests for free each month.

Amazon SQS compatibility

Amazon SQS is compatible with many other AWS products, including Amazon Relational Database Service, Amazon Elastic Compute Cloud and Amazon Simple Storage Service.

Learn what enhancements Amazon has made to its voice assistant, Alexa, and in which smart-home products you can expect to see these advancements.

This was last updated in October 2021

Continue Reading About Amazon Simple Queue Service (SQS)

Dig Deeper on AWS cloud development

App Architecture
Cloud Computing
Software Quality