| Did this page help you? Yes No Tell us about it... |
The SetQueueAttributes action sets one attribute of a queue per request. When you
change a queue's attributes, the change can take up to 60 seconds to propagate
throughout the SQS system.
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 Common Query Parameters).
| Name | Description | Required |
|---|---|---|
|
|
The name of the attribute you want to set.
Type: String Valid Values: Default: None |
Yes |
|
|
The value of the attribute you want to set. To delete a queue's access control policy, set the policy to "". Constraints: Constraints are specific for each value.
Default: Varies according to attribute |
Yes |
The response contains no special elements besides the common elements in all successful responses (for more information, see Responses section in the Amazon SQS Developer Guide.
The following table lists the special errors the
SetQueueAttributes action returns in addition to the common
errors all actions return (for more information, see Common Errors).
| Error | Description | HTTP Status Code |
|---|---|---|
|
|
Unknown attribute |
400 |
The following example Query request sets a policy that gives all users ReceiveMessage permission for the queue named 195004372649/testQueue.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=SetQueueAttributes &Version=2009-02-01 &Attribute.Name=Policy &Attribute.Value=%7B%22Version%22%3A%222008-10-17%22%2C%22Id%22 %3A%22%2F195004372649%2FtestQueue%2FSQSDefaultPolicy%22%2C%22Stat ement%22%3A%5B%7B%22Sid%22%3A%22Queue1ReceiveMessage%22%2C%22Effe ct%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22*%22%7D %2C%22Action%22%3A%22SQS%3AReceiveMessage%22%2C%22Resource%22%3A% 22%2F195004372649%2FtestQueue%22%7D%5D%7D &Timestamp=2009-05-06T16%3A57%3A31.000Z &AWSAccessKeyId=0AZAVD7PQ3DCC3452ZG2 &Signature=%2Bd7ZlPIdnb%2BhpEna2TgfwQjfGF8%3D
The above policy value is form-url-encoded from the following text:
{
"Version":"2008-10-17",
"Id":"/195004372649/testQueue/SQSDefaultPolicy",
"Statement": [
{
"Sid":"Queue1ReceiveMessage",
"Effect":"Allow",
"Principal":{"AWS":"*"},
"Action":"SQS:ReceiveMessage",
"Resource":"/195004372649/testQueue"
}
]
}For more examples of policies, see Amazon SQS Policy Examples in the Amazon SQS Developer Guide.
The following example Query request sets the visibility timeout to 35 seconds for the queue named 123456789012/testQueue.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=SetQueueAttributes &Attribute.Name=VisibilityTimeout &Attribute.Value=35 &Version=2009-02-01 &SignatureMethod=HmacSHA256 &Expires=2009-04-18T22%3A52%3A43PST &AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE &SignatureVersion=2 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
<SetQueueAttributesResponse>
<ResponseMetadata>
<RequestId>
e5cca473-4fc0-4198-a451-8abb94d02c75
</RequestId>
</ResponseMetadata>
</SetQueueAttributesResponse>