The CreateQueue action creates a new queue. You must provide a queue name that is unique within the scope of the queues you own. The queue is assigned a queue URL; you must use this URL when performing actions on the queue.
When you create a queue, if a queue with the same name already exists, CreateQueue returns the queue URL with an error indicating that the queue already exists.
When you create a queue, FullControl access rights are granted to you for the queue. Only you (as owner of the queue), or a grantee assigned FullControl rights to the queue, can grant or deny access rights to the queue and its messages.
Note: | You must be signed up for Amazon SQS for the request to succeed, as SQS is not a free service. |
The default value for VisibilityTimeout is also set when a queue is created. See SetVisibilityTimeout (Query) for information about how visibility timeout works.
CreateQueue requests are validated on the following:
The value specified for QueueName must be alphanumeric of length 1 to 80.
If specified, the value specified for DefaultVisibilityTimeout must be between 0 and 86400.
| Name | Description | Type | Value |
|---|---|---|---|
QueueName | The name to use for the queue created. The queue name must be unique within the scope of all your queues. | Required | An alphanumeric string specifying the name of the queue to create. Maximum 80 characters. |
DefaultVisibilityTimeout | Sets the default visibility timeout for this queue. If this parameter is not included, the default value is set to 30 seconds. For more information, see SetVisibilityTimeout. | Optional | Integer |
The following example of a CreateQueue action creates a new queue named queue2.
http://queue.amazonaws.com/ ?Action=CreateQueue &QueueName=queue2 &AWSAccessKeyId=0GS7573JW74RZM612K0A &Version=2006-04-01 &Expires=2007-01-12T12:00:00Z &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQE=
<CreateQueueResponse
xmlns=http://queue.amazonaws.com/doc/2006-04-01/
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:type=CreateQueueResponse>
<QueueUrl>
http://queue.amazonaws.com/A23E9WXPHGOG29/queue2
</QueueUrl>
<ResponseStatus>
<StatusCode>Success</StatusCode>
<RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
</ResponseStatus>
</CreateQueueResponse>| Error | Description |
|---|---|
| InvalidParameterValue | QueueName did not pass validation. |
| InvalidParameterValue | DefaultVisibilityTimeout is specified and is not between 0 and 86400 |
Specifying a QueueName that is too long or not alphanumeric results in the following error:
<Response>
<Errors>
<Error>
<Code>
InvalidParameterValue
</Code>
<Message>
Value (quename_nonalpha) for parameter QueueName is invalid.
Must be an alphanumeric String of 1 to 80 in length
</Message>
</Error>
</Errors>
<RequestID>
42d59b56-7407-4c4a-be0f-4c88daeea257
</RequestID>
</Response>