Amazon Simple Queue Service (SQS) is a fast, reliable, scalable, fully managed message queuing service. SQS makes it simple and cost-effective to decouple the components of a cloud application. You can use SQS to transmit any volume of data, at any level of throughput, without losing messages or requiring other services to be always available.
With SQS, you can offload the administrative burden of operating and scaling a highly available messaging cluster, while paying a low price for only what you use.
Developers can create an unlimited number of Amazon SQS queues with an unlimited number of messages.
A queue can be created in any region.
The message payload can contain up to 256KB of text in any format. Each 64KB ‘chunk’ of payload is billed as 1 request. For example, a single API call with a 256KB payload will be billed as four requests.
Messages can be sent, received or deleted in batches of up to 10 messages or 256KB. Batches cost the same amount as single messages, meaning SQS can be even more cost effective for customers that use batching.
Long polling reduces extraneous polling to help you minimize cost while receiving new messages as quickly as possible. When your queue is empty, long-poll requests wait up to 20 seconds for the next message to arrive. Long poll requests cost the same amount as regular requests.
Messages can be retained in queues for up to 14 days.
Messages can be sent and read simultaneously.
When a message is received, it becomes “locked” while being processed. This keeps other computers from processing the message simultaneously. If the message processing fails, the lock will expire and the message will be available again. In the case where the application needs more time for processing, the “lock” timeout can be changed dynamically via the ChangeMessageVisibility operation.
Developers can securely share Amazon SQS queues with others. Queues can be shared with other AWS accounts and Anonymously. Queue sharing can also be restricted by IP address and time-of-day.
When combined with Amazon Simple Notification Service (SNS), developers can 'fanout' identical messages to multiple SQS queues in parallel. When developers want to process the messages in multiple passes, fanout helps complete this more quickly, and with fewer delays due to bottlenecks at any one stage. Fanout also makes it easier to record duplicate copies of your messages, for example in different databases.
Amazon SQS provides significant advantages over the complexity of home-grown message queuing systems or the ongoing expense of licensed or hosted messaging systems.
Reliable Amazon SQS runs within Amazon’s high-availability data centers, so queues will be available whenever applications need them. To prevent messages from being lost or becoming unavailable, all messages are stored redundantly across multiple servers and data centers.
Simple Developers can get started with Amazon SQS by using only five APIs: CreateQueue, SendMessage, ReceiveMessage, ChangeMessageVisibility, and DeleteMessage. Additional APIs are available to provide advanced functionality.
Scalable Amazon SQS was designed to enable an unlimited number of services to read and write an unlimited number of messages at any time.
Secure Authentication mechanisms are provided to ensure that messages stored in Amazon SQS queues are secured against unauthorized access.
Inexpensive No up-front or fixed expenses. The only costs of sending messages through Amazon SQS are small per-request handling fees and data transfer fees.
You can get started with Amazon SQS for free. New and existing
customers receive 1 million Amazon SQS queuing requests for free each
month. Some applications may be able to operate within this free
$0.50 per 1 million Amazon SQS Requests ($0.0000005 per SQS Request)
Batches of up to 10 messages or 256KB per request cost the same amount as single messages.
Each 64KB ‘chunk’ of payload is billed as 1 request. For example, a single API call with a 256KB payload will be billed as four requests.
The pricing below is based on data transferred “in” and “out” of Amazon SQS.
Data transfer “in” and “out” refers to
transfer into and out of Amazon SQS. Data transferred between Amazon
SQS and Amazon EC2 within a single region is free of charge (i.e.,
$0.00 per GB). Data transferred between Amazon SQS and Amazon EC2 in
different regions will be charged at Internet Data Transfer rates on
both sides of the transfer.
* Your free usage is calculated each month across all regions and automatically applied to your bill – free usage does not accumulate. ** As part of AWS’s Free Usage Tier, new AWS customers will receive free 15 GB of data transfer out each month aggregated across all AWS services for one year. *** Data transfer out rate tiers aggregate outbound data transfer across Amazon EC2, Amazon EBS, Amazon S3, Amazon Glacier, Amazon RDS, Amazon SimpleDB, Amazon SQS, Amazon SNS, Amazon DynamoDB, AWS Storage Gateway, and Amazon VPC.
Amazon SQS can be easily accessed through the AWS Management Console, which gives users a point-and-click, web-based interface to setup and manage Amazon SQS.
Basic Queue Requests
Amazon SQS employs a simple interface that is easy to use and highly flexible. The following requests are provided:
CreateQueue: Create queues for use with your AWS account.
ListQueues: List your existing queues.
DeleteQueue: Delete one of your queues.
SendMessage: Add messages to a specified queue.
SendMessageBatch: Add multiple messages to a specified queue.
ReceiveMessage: Return one or more messages from a specified queue.
ChangeMessageVisibility: Change the visibility timeout of previously received message.
ChangeMessageVisibilityBatch: Change the visibility timeout of multiple previously received messages.
DeleteMessage: Remove a previously received message from a specified queue.
DeleteMessageBatch: Remove multiple previously received messages from a specified queue.
SetQueueAttributes: Control queue settings like the amount of time that messages are locked after being read so they cannot be read again.
GetQueueAttributes: Get information about a queue like the number of messages in it.
GetQueueUrl: Get the queue URL.
AddPermission: Add queue sharing for another AWS account for a specified queue.
RemovePermission: Remove an AWS account from queue sharing for a specified queue.
Amazon SQS Message Lifecycle
Messages that are stored in Amazon SQS have a lifecycle that is easy to manage but ensures that all messages are processed.
A system that needs to send a message will find an Amazon SQS queue, and use SendMessage to add a new message to it.
A different system that processes messages needs more messages to process, so it calls ReceiveMessage, and this message is returned.
Once a message has been returned by ReceiveMessage, it will not be returned by any other ReceiveMessage until the visibility timeout has passed. This keeps multiple computers from processing the same message at once.
If the messaging system successfully finishes working with this message, it calls DeleteMessage, which removes the message from the queue so no one else will ever process it. If this system fails to process the message, then it will be read by another ReceiveMessage call as soon as the visibility timeout passes.