Amazon Simple Queue Service FAQs
Introduction and Getting Started
Features, Functionality and Interfaces
Security and Reliability
Limits, Restrictions
Queue Sharing
Ireland and Northern California regions
WSDL 2006/2007 Deprecation and “End-of-Life”
Find more answers in Amazon SQS Technical FAQs
Introduction and Getting Started
-
Q: What is Amazon SQS?
-
Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed application components performing different tasks, without losing messages or requiring each component to be always available. Amazon SQS makes it easy to build an automated workflow, working in close conjunction with the Amazon Elastic Compute Cloud (Amazon EC2) and the other AWS infrastructure web services.
-
Q: What can I do with Amazon SQS?
-
Amazon SQS is a web service that gives you access to a message queue that can be used to store messages while waiting for a computer to process them. This allows you to quickly build message queuing applications that can be run on any computer on the internet. Since Amazon SQS is highly scalable and you only pay for what you use, you can start small and grow your application as you wish, with no compromise on performance or reliability. This lets you focus on building sophisticated message-based applications, without worrying about how the messages are stored and managed. You can use Amazon SQS with software applications in various ways. For example, you can:
- Integrate Amazon SQS with other AWS infrastructure web services to make applications more reliable and flexible.
- Use an Amazon SQS queue as a queue of work where each message is a task that needs to be completed by a process. One or many computers can read tasks from the queue and perform them.
- Have Amazon SQS help a browser-based application receive notifications from a server. The application server can add the notifications to a queue, which the browser can poll—even if there is a firewall between them.
- Keep notifications of significant events in a business process in an Amazon SQS queue. Each event can have a corresponding message in a queue, and applications that need to be aware of the event can read and process the messages.
-
Q: How can I get started using Amazon SQS?
-
To sign up for Amazon SQS, click the “Sign up for This Web Service” button on the Amazon SQS detail page. You must have an Amazon Web Services account to access this service; if you do not already have one, you will be prompted to create one when you begin the Amazon SQS sign-up process. After signing up, please refer to the Amazon SQS documentation and sample code in the Resource Center to begin using Amazon SQS.
-
Q: How much does Amazon SQS cost?
-
You pay only for what you consume, and there is no minimum fee. You pay $0.01 for every ten thousand requests ($1 for a million requests), $0.10 per GB of data transferred into Amazon SQS and $0.15 per GB (sliding lower with volume) of data transferred out of Amazon SQS. Usage is measured to the nearest byte and charges rounded up to the nearest cent. Data transferred between Amazon SQS and Amazon EC2 in the U.S. is free of charge (i.e., $0.00 per GB). Data transferred between Amazon SQS and Amazon EC2 in another region (e.g. Amazon EC2 in the E.U.) will be charged at Internet Data Transfer rates on both sides of the transfer. Amazon SQS requests are: CreateQueue, ListQueues, DeleteQueue, SendMessage, ReceiveMessage, DeleteMessage, SetQueueAttributes and GetQueueAttributes
-
Q: How will I be charged and billed for my use of Amazon SQS?
-
There are no set-up fees to begin using the service. At the end of the month, your credit card will automatically be charged for that month’s usage. You can view your charges for the current billing period at any time on the Amazon Web Services web site by logging into your Amazon Web Services account and clicking “Account Activity” under “Your Web Services Account”.
-
Q: What are the benefits of Amazon SQS vs. homegrown or packaged message queuing systems?
-
Using Amazon SQS provides several advantages over building your own software for managing message queues or using a commercial or open-source message queuing system. The alternatives require significant upfront time to develop and configure compared to integrating with an existing web service. Also, these alternatives require ongoing hardware and system administrative resources to operate. The complexity of configuring and managing these systems is compounded if they need to be configured to provide redundant storage of messages so messages are not lost if hardware fails. By contrast, Amazon SQS incurs no administrative overhead and requires little configuration.
-
Q: Does Amazon use Amazon SQS for its own applications?
-
Yes. Developers within Amazon use Amazon SQS for a wide variety of projects and represent a large number of Amazon SQS messages per day. Applications using Amazon SQS include key business processes for the Amazon.com retail web site and Amazon Web Services.
Features, Functionality and Interfaces
-
Q: Can Amazon SQS be used with other AWS services?
-
Amazon SQS can be used with Amazon EC2, as well as Amazon S3 and Amazon SimpleDB, to make applications more flexible and scalable. A common use case is to create an integrated and automated workflow, where multiple components or modules need to communicate with each other, but can’t all process the same amount of work simultaneously. In this case, Amazon SQS queues carry messages to be processed in an orderly fashion by the user’s application running on Amazon EC2 instances. The Amazon EC2 instances can read the queue, process the job, and then post the results as messages to another Amazon SQS queue (possibly for further processing by another application). Because Amazon EC2 allows applications to scale up and down dynamically, application developers can easily vary the number of compute instances based on the amount of work in the SQS queues, to ensure that jobs are executed in a timely manner.
For example, here is how a video transcoding website uses Amazon EC2, Amazon SQS, Amazon S3, and Amazon SimpleDB together. End users submit videos to be transcoded to the website. The videos are stored in Amazon S3, and a message (“the request message”) is placed in an Amazon SQS queue (“the incoming queue”) with a pointer to the video and to the target video format in the message. The transcoding engine, running on a set of Amazon EC2 instances, reads the request message from the incoming queue, retrieves the video from Amazon S3 using the pointer, and transcodes the video into the target format. The converted video is put back into Amazon S3 and another message (“the response message”) is placed in another Amazon SQS queue (“the outgoing queue”) with a pointer to the converted video. At the same time, metadata about the video (e.g. format, date created and length) can be indexed into Amazon SimpleDB for easy querying. During this whole workflow, a dedicated Amazon EC2 instance can constantly monitor the incoming queue and, based on the number of messages in the incoming queue, is able to dynamically adjust the number of transcoding Amazon EC2 instances to meet customers’ response time requirements.
-
Q: How do I interface with Amazon SQS?
-
Amazon SQS provides simple, standards-based SOAP and Query web services interfaces that are designed to work with any Internet-development toolkit. The operations are intentionally made simple to work with messages and queues.
-
Q: What are the available operations for queues? Who can perform operations on a queue?
-
The following set of operations is defined for Amazon SQS: CreateQueue, ListQueues, DeleteQueue, SendMessage, ReceiveMessage, DeleteMessage, SetQueueAttributes, and GetQueueAttributes. Operations can be performed only by the AWS account owner.
-
Q: How are messages identified in the system?
-
All messages have a globally unique ID that Amazon SQS returns when the message is delivered to the queue. The ID isn’t required in order to perform any further actions on the message, but it’s useful for tracking whether a particular message in the queue has been received. When you receive a message from the queue, the response includes a receipt handle, which you must provide when deleting the message.
-
Q: Does Amazon SQS provide first-in-first-out (FIFO) access to messages?
-
No, Amazon SQS does not guarantee FIFO access to messages in Amazon SQS queues, mainly because of the distributed nature of the Amazon SQS. If you require specific message ordering, you should design your application to handle it.
-
Q: What is the maximum limit for message visibility?
-
Amazon SQS supports up to 12 hours maximum visibility timeout for the 2009 WSDL.
-
Q: What new attributes are supported?
-
Amazon SQS now supports additional attributes such as when a message was sent and who sent the message. Please refer to the Amazon SQS WSDL 2009 documentation for all of the attributes supported.
-
Q: How can a developer determine “time-in-queue”?
-
Developers can request the “SentTimestamp” attribute when receiving a message. Subtracting that value from the current time results in the “time-in-queue” value.
-
Q: What is the “SenderId” attribute value of a message in the case of anonymous access?
-
Amazon SQS provides the IP address when the AWS account ID is not available such as when an anonymous user sends a message.
Security and Reliability
-
Q: How reliably is my data stored in Amazon SQS?
-
Amazon SQS stores all queue and message information in Amazon’s network of highly reliable, highly available data centers. All messages are stored redundantly on multiple servers and in multiple data centers, which means that no single computer or network failure renders SQS messages inaccessible.
-
Q: How can I secure the messages in my queues?
-
Authentication mechanisms are provided to ensure that messages stored in Amazon SQS queues are secured against unauthorized access. Only the AWS account owners can access the queues they create.
Amazon SQS uses proven cryptographic methods to authenticate your identity, either through the use of your Access Key ID and request signature, or through the use of an X.509 certificate. For the details of how to use either of these authentication mechanisms with Amazon SQS, please see the Amazon SQS Developer Guide.
For additional security, you could build your application to encrypt messages before they are placed in a queue.
-
Q: How does Amazon SQS allow multiple readers to access the same message queue, without losing messages or processing them many times?
-
Every Amazon SQS queue has a configurable visibility timeout. For the designated amount of time after a message is read from a queue, it will not be visible to any other reader. As long as the amount of time that it takes to process the message is less than the visibility timeout, every message will be processed and deleted. In the event that the component processing the message fails or becomes unavailable, the message will again become visible to any component reading the queue once the visibility timeout ends. This allows you to have many components all reading messages from the same queue, with each working to process different messages.
-
Q: How many times will I receive each message?
-
Amazon SQS is engineered to provide “at least once” delivery of all messages in its queues. Although most of the time each message will be delivered to your application exactly once, you should design your system so that processing a message more than once does not create any errors or inconsistencies.
-
Q: Why are there separate ReceiveMessage and DeleteMessage operations?
-
When Amazon SQS returns a message to you, that message stays in the queue, whether or not you actually received the message. You are responsible for deleting the message; the delete request acknowledges that you’re done processing the message. If you don’t delete the message, Amazon SQS will deliver it again on another receive request.
-
Q: Can a deleted message be received again?
-
Yes, under rare circumstances you might receive a previously deleted message again. This can occur in the rare situation in which a DeleteMessage operation doesn’t delete all copies of a message because one of the servers in the distributed Amazon SQS system isn’t available at the time of the deletion. That message copy can then be delivered again. You should design your application so that no errors or inconsistencies occur if you receive a deleted message again.
-
Q: What happens if I issue a DeleteMessage request on a previously deleted message?
-
SQS returns a “success” response.
Limits, Restrictions
-
Q: How long can I keep my messages in Amazon SQS queues?
-
You can keep your messages in a queue for up to 4 days, after which we reserve the right to delete the messages. You must design your application with this in mind. Amazon SQS is designed to provide transient storage for messages waiting to be processed, and not long-term data storage.
-
Q: How much and what kind of data can go in a message?
-
Amazon SQS messages can contain up to 8 KB of text data, including XML, JSON and unformatted text. The following Unicode characters are accepted:
#x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]
(according to http://www.w3.org/TR/REC-xml/#charsets).
-
Q: How big can Amazon SQS queues be?
-
A single queue may contain an unlimited number of messages, and you can create an unlimited number of queues.
-
Q: Are there restrictions on the names of Amazon SQS queues? Is there a size limit on the name of Amazon SQS queues? Can a queue name be reused?
-
Queue names are limited to 80 characters. Alphanumeric characters plus hyphens (-) and underscores (_) are allowed. Queue names must be unique within an AWS account. After you delete a queue, you can reuse the queue name.
-
Q: What happens if there is no activity against a queue for an extended period of time?
-
We reserve the right to delete a queue if none of the following requests have been issued against the queue for more than 30 consecutive days: SendMessage, ReceiveMessage, DeleteMessage, GetQueueAttributes and SetQueueAttributes. You should design your application with this in mind.
Queue Sharing
-
Q: How do I share a queue?
-
A developer associates an access policy statement (specifying the permissions being granted) with the queue to be shared. Amazon SQS provides APIs to create and manage the access policy statements: AddPermission, RemovePermission, SetQueueAttributes and GetQueueAttributes. Refer to WSDL 2009 API specification for more details.
-
Q: Who pays for shared queue access?
-
The queue owner pays for shared queue access.
-
Q: How do I identify another AWS user?
-
The Amazon SQS API uses the AWS account number to identify AWS users.
-
Q: What do I need to provide other users in order to share a queue with them?
-
You’ll need to provide the full URL from the queue to share. The CreateQueue and ListQueues operations return this URL in their response.
-
Q: Does Amazon SQS support Anonymous access?
-
Yes – with the WSDL 2009 API, a developer can set an access policy that allows anonymous users access to a queue.
-
Q: When would I use the Permissions API?
-
The Permissions API provides a simple interface for developers to share access to a queue but it cannot allow for conditional access and more advanced use cases.
-
Q: When would I use SetQueueAttributes with JSON objects?
-
The SetQueueAttributes operation supports the full access policy language. Using the policy language, access to a queue can be restricted by IP address and time of day for instance. Refer to the access policy documentation (appendix in Amazon SQS WSDL 2009 API documentation) for more details.
Ireland and Northern California regions
-
Q: What is the Ireland End-Point?
-
http://eu-west-1.queue.amazonaws.com is the end-point for Amazon SQS in the Ireland region.
-
Q: What is the Northern California End-Point?
-
http://us-west-1.queue.amazonaws.com is the end-point for Amazon SQS in the Northern California region.
-
Q: Can messages be shared between queues in different regions?
-
No – Amazon SQS in each region is totally independent in message stores and queue names.
-
Q: Is there a pricing difference between regions?
-
No – Amazon SQS pricing is the same for all 3 regions.
-
Q: What is the pricing structure between various regions?
-
Data transferred between Amazon SQS and Amazon EC2 within a single region is free of charge. Data transferred between Amazon SQS and Amazon EC2 in different regions will be charged at the normal data transfer rate.
WSDL 2006/2007 Deprecation and “End-of-Life”
-
Q: How will you determine which users can continue to use the 2006/2007 WSDL?
-
An existing 2006/2007 WSDL Amazon SQS user is defined as someone who has sent a message in the last 30 days (e.g. between April 7, 2009 and May 6, 2009).
-
Q: What happens if a non-authorized user makes a WSDL 2006/2007 request?
-
Amazon SQS will return a 4xx error specifying the user is not authorized for this WSDL version.
-
Q: Is there help on migrating to a new Amazon SQS WSDL?
-
Yes – Amazon SQS has a migration guide available.