SetQueueAttributes

Description

The SetQueueAttributes action sets an attribute of a queue. Currently, you can set only the VisibilityTimeout attribute for a queue. For more information about this attribute, see Visibility Timeout. When you change a queue's attributes, the change can take up to 60 seconds to propagate throughout the SQS system.

[Important]Important

Before the 2007-05-01 release introduced the SetQueueAttributes action, you set the visibility timeout by using the SetVisibilityTimeout action. As of the 2008-01-01 release of Amazon SQS, the SetVisibilityTimeout action is no longer supported.

Request Parameters

The following table lists the special request parameters the SetQueueAttributes action uses in addition to the common request parameters all actions use (for more information, see Request Parameters Common to All Actions).

NameDescriptionRequired

Attribute.Name

The name of the attribute you want to set.

Type: String

Valid Value: VisibilityTimeout

Yes

Attribute.Value

The value of the attribute you want to set.

Type: For visibility timeout, the value must be an integer from 0 to 7200, inclusive (maximum 2 hours).

Yes

Response Elements

The response contains no special elements besides the common elements in all successful responses (for more information, see Structure of a Successful Response).

Special Errors

The following table lists the special errors the SetQueueAttributes action returns in addition to the common errors all actions return (for more information, see Errors Common to all Actions).

ErrorDescriptionHTTP Status Code

InvalidAttributeName

Unknown attribute

400

Examples

The following example Query request sets the visibility timeout to 35 seconds for the specified queue (queue2).

Sample Request

http://queue.amazonaws.com/queue2
?Action=SetQueueAttributes
&Attribute.Name=VisibilityTimeout
&Attribute.Value=35
&AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE
&Version=2008-01-01
&Expires=2008-02-10T12:00:00Z
&Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
&SignatureVersion=2
&SignatureMethod=HmacSHA256

Sample Response

<SetQueueAttributesResponse>
  <ResponseMetadata>
    <RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
  </ResponseMetadata>
</SetQueueAttributesResponse>

Related Actions