SetQueueAttributes#

Description#

Sets the values of one or more queue attributes.

Request Syntax#

POST / HTTP/1.1
Content-type: application/json

{
    "QueueUrl": "string",
    "Attributes": {
        "VisibilityTimeout": "string",
        "DelaySeconds": "string",
        "MaximumMessageSize": "string",
        "MessageRetentionPeriod": "string",
        "ReceiveMessageWaitTimeSeconds": "string",

    }
}

Request Parameters#

  • Attributes — The queue attributes to be set (see Supported attributes.

    • Type: Object

    • Required: Yes

  • QueueUrl — The queue URL.

    • Type: String

    • Required: Yes

Supported attributes#

  • DelaySeconds — The time (in seconds) for which delivery of all messages in the queue is delayed.

    • Type: String

    • Required: No

    • Range: From 0 to 900 (15 minutes)

  • MaximumMessageSize — The maximum message size (in bytes).

    • Type: String

    • Required: No

    • Range: 1024 to 262144

  • MessageRetentionPeriod — The time (in seconds) during which SQS retains a message.

    • Type: String

    • Required: No

    • Range: 60 to 1209600 (14 days)

  • ReceiveMessageWaitTimeSeconds — The wait time (in seconds) for a long polling mode.

    • Type: String

    • Required: No

    • Range: 2 to 20

  • VisibilityTimeout — The time (in seconds) during which a message remains invisible after being received.

    • Type: String

    • Required: No

    • Range: 0 to 43,200 (12 hours)

Response Syntax#

HTTP/1.1 200
Content-type: application/json

{
    "Success": boolean
}

Response Elements#

  • Success — The operation result.

    • Type: Boolean

Errors#

  • InvalidParameterValue — The parameter value is invalid or the attribute cannot be modified.

  • QueueDoesNotExist — The specified queue does not exist.

Examples#

boto3
 import boto3

 session = boto3.Session(
    aws_access_key_id="<AWS_ACCESS_KEY_ID>",
    aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
    region_name="",
 )

 sqs_client = session.client(
    'sqs',
    endpoint_url='https://sqs.ru-msk.k2.cloud/'
 )

 sqs_client.set_queue_attributes(
     QueueUrl='https://sqs.ru-msk.k2.cloud/123456789012/my-queue',
     Attributes={
         'VisibilityTimeout': '120',
         'ReceiveMessageWaitTimeSeconds': '20'
     }
 )
aws-cli
 aws sqs --endpoint https://sqs.ru-msk.k2.cloud/ set-queue-attributes \\
     --queue-url https://sqs.ru-msk.k2.cloud/123456789012/my-queue \\
     --attributes VisibilityTimeout=120,ReceiveMessageWaitTimeSeconds=20