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 (SOAP) 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.
| Name | Description | Type | Value |
|---|---|---|---|
QueueName
| The name to use for the queue created. The queue name must be unique for all queues within the scope of 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 with name queue2.
<soap:Body wsu:Id="body" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/ oasis-200401-wss-wssecurity-utility-1.0.xsd"> <m:CreateQueue xmlns:m="http://queue.amazonaws.com/doc/2006-04-01/"> <m:QueueName>queue2</m:QueueName> </m:CreateQueue> </soap:Body>
| Error | Description |
|---|---|
| InvalidParameterValue | QueueName did not pass validation. |
| InvalidParameterValue | DefaultVisibilityTimeout is specified and is not between 0 and 86400. |
Specifying a QueueName is too long or not alphanumeric results in the following error:
<soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope
xmlns:aws=http://webservices.amazon.com/AWSFault/2005-15-09>
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
<soap:Subcode>
<soap:Value>
aws:InvalidParameterValue
</soap:Value>
</soap:Subcode>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang=en-US>
Value (abcdefghijklmnopqrstuvwxyzqueue5) for parameter QueueName is invalid.
Must be an alphanumeric String of 1 to 20 in length
</soap:Text>
</soap:Reason>
<soap:Detail>
<aws:RequestId xmlns:aws=http://webservices.amazon.com/AWSFault/2005-15-09>
af8adcb5-2236-41e9-bdaf-8da6f218318c
</aws:RequestId>
</soap:Detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>