The CreateQueue action creates a new queue.
When you request CreateQueue, you provide a name for the queue. To
successfully create a new queue, you must provide a name that is unique
within the scope of your own queues. If you provide the name of an existing queue, a new queue
isn't created and an error isn't returned. Instead, the request succeeds and the queue URL for the
existing queue is returned (for more information about queue URLs, see Queue URLs). Exception: if you provide a value for
DefaultVisibilityTimeout that is different from the value for the
existing queue, you receive an error.
![]() | Note |
|---|---|
If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. |
A default value for the queue's visibility timeout (30 seconds) is set when the queue is
created. You can override this value with the DefaultVisibilityTimeout
request parameter. For more information, see Visibility Timeout.
The following table lists the special request parameters the CreateQueue
action uses in addition to the common parameters all actions use (for more information, see Request Parameters Common to All Actions).
| Name | Description | Required |
|---|---|---|
|
|
The name to use for the queue created. Type: String Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed. |
Yes |
|
|
The visibility timeout (in seconds) to use for this queue. Type: Integer Constraints: 0 to 7200, inclusive (maximum 2 hours) Default: 30 seconds |
No |
The following table lists the elements the CreateQueue response includes in
addition to the elements returned in all successful responses (for more information, see Structure of a Successful Response).
| Name | Description |
|---|---|
|
|
The queue URL for the queue you created. Type: String Ancestor: |
The following table lists the special errors the CreateQueue action returns
in addition to the common errors all actions return (for more information, see Errors Common to all Actions).
| Error | Description | HTTP Status Code |
|---|---|---|
|
|
You must wait 60 seconds after deleting a queue before you can create another with the same name. |
400 |
|
|
Queue already exists. SQS returns this error only if the request includes
a |
400 |
The following example Query request creates a new queue named queue2.
http://queue.amazonaws.com/ ?Action=CreateQueue &QueueName=queue2 &AWSAccessKeyId=0GS7573JW74RZM612K0AEXAMPLE &Version=2008-01-01 &Expires=2008-02-10T12:00:00Z &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE &SignatureVersion=2 &SignatureMethod=HmacSHA256
<CreateQueueResponse
xmlns=http://queue.amazonaws.com/doc/2008-01-01/
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:type=CreateQueueResponse>
<CreateQueueResult>
<QueueUrl>
http://queue.amazonaws.com/queue2
</QueueUrl>
</CreateQueueResult>
<ResponseMetadata>
<RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
</ResponseMetadata>
</CreateQueueResponse>