Operations (sample payloads)

Main operations
Copy

Delete Messages
Copy

Delete multiple messages from an SQS queue

Sample Input

1
{
2
"queue_name": "my-sqs-queue",
3
"entries_to_delete": [
4
{
5
"Id": "msg1",
6
"ReceiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a..."
7
},
8
{
9
"Id": "msg2",
10
"ReceiptHandle": "AQEBzWwaftRI0KuVm4tP+/7q1rGgNqicHq..."
11
},
12
{
13
"Id": "msg3",
14
"ReceiptHandle": "AQEB9nLDh8bvfQMts8o+GbHfssY0rbjhSv..."
15
}
16
]
17
}

Sample Output

1
{
2
"ResponseMetadata": {
3
"RequestId": "5fea1756-0ec7-5c24-b3fc-9ce5b744f4df"
4
},
5
"Successful": [
6
{
7
"Id": "msg1"
8
},
9
{
10
"Id": "msg2"
11
},
12
{
13
"Id": "msg3"
14
}
15
],
16
"Failed": []
17
}

Get queue attributes
Copy

Gets attributes for the specified queue.

Sample Input

1
{
2
"queue_name": "my-sqs-queue",
3
"attribute_names": [
4
"All"
5
]
6
}

Sample Output

1
{
2
"headers": {},
3
"body": {
4
"ResponseMetadata": {
5
"RequestId": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p"
6
},
7
"Attributes": {
8
"QueueArn": "arn:aws:sqs:us-east-1:123456789012:my-sqs-queue",
9
"ApproximateNumberOfMessages": "42",
10
"ApproximateNumberOfMessagesNotVisible": "5",
11
"ApproximateNumberOfMessagesDelayed": "0",
12
"CreatedTimestamp": "1620000000",
13
"LastModifiedTimestamp": "1620100000",
14
"VisibilityTimeout": "30",
15
"MaximumMessageSize": "262144",
16
"MessageRetentionPeriod": "345600",
17
"DelaySeconds": "0",
18
"ReceiveMessageWaitTimeSeconds": "0"
19
}
20
}
21
}

List Queues
Copy

List queues available for this account.

Sample Input

1
{}

Sample Output

1
{
2
"queues": [
3
"https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue1",
4
"https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue2",
5
"https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue3"
6
]
7
}

Purge Queue
Copy

Deletes the messages in a queue. When you use the Purge Queue action, you can't retrieve a message deleted from a queue.

Sample Input

1
{
2
"queue_name": "my-important-queue"
3
}

Sample Output

1
{
2
"ResponseMetadata": {
3
"RequestId": "a1b2c3d4-5e6f-7g8h-9i0j-k1l2m3n4o5p6"
4
}
5
}

Receive and Delete Messages
Copy

Receive and delete messages from an SQS queue in multiple batches to create one large batch. This may result in loss of some messages if the operation times out or fails internally

Sample Input

1
{
2
"queue_name": "my-sqs-queue",
3
"max_number_of_messages": 50,
4
"message_attribute_names": [
5
"All"
6
],
7
"attribute_names": [
8
"All"
9
],
10
"parse_json": true
11
}

Sample Output

1
{
2
"messages": [
3
{
4
"Attributes": {
5
"ApproximateFirstReceiveTimestamp": "1623456789012",
6
"ApproximateReceiveCount": "1",
7
"SenderId": "AIDACKCEVSQ6C2EXAMPLE",
8
"SentTimestamp": "1623456788000"
9
},
10
"Body": "{\"orderId\": \"12345\", \"customerName\": \"John Doe\", \"totalAmount\": 99.99}",
11
"MD5OfBody": "51b0a325...e39a90b0",
12
"MD5OfMessageAttributes": "00484c68...59e71517",
13
"MessageAttributes": {
14
"City": {
15
"DataType": "String",
16
"StringValue": "New York"
17
},
18
"PostalCode": {
19
"DataType": "String",
20
"StringValue": "10001"
21
}
22
},
23
"MessageId": "5fea7756-0ea4-451a-a703-a558b933e274",
24
"ReceiptHandle": "AQEBZWQgX...fqNzFbWC"
25
}
26
],
27
"entries_to_delete": [
28
{
29
"Id": "5fea7756-0ea4-451a-a703-a558b933e274",
30
"ReceiptHandle": "AQEBZWQgX...fqNzFbWC"
31
}
32
]
33
}

Receive Messages
Copy

Receive multiple messages from an SQS queue. The messages are not deleted from the queue.

Sample Input

1
{
2
"queue_name": "my-sqs-queue",
3
"max_number_of_messages": 5,
4
"wait_time_seconds": 10,
5
"visibility_timeout": 60,
6
"message_attribute_names": [
7
"All"
8
],
9
"attribute_names": [
10
"ApproximateReceiveCount",
11
"SentTimestamp"
12
],
13
"parse_json": true
14
}

Sample Output

1
{
2
"messages": [
3
{
4
"Attributes": {
5
"ApproximateFirstReceiveTimestamp": "1623456789012",
6
"ApproximateReceiveCount": "1",
7
"SenderId": "AIDACKCEVSQ6C2EXAMPLE",
8
"SentTimestamp": "1623456788000"
9
},
10
"Body": "{\"orderId\": \"12345\", \"status\": \"shipped\"}",
11
"MD5OfBody": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
12
"MD5OfMessageAttributes": "q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1",
13
"MessageAttributes": {
14
"City": {
15
"DataType": "String",
16
"StringValue": "Seattle"
17
},
18
"PostalCode": {
19
"DataType": "String",
20
"StringValue": "98101"
21
}
22
},
23
"MessageId": "abcdef12-3456-7890-abcd-ef1234567890",
24
"ReceiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a..."
25
}
26
],
27
"entries_to_delete": [
28
{
29
"messageIndex": "0",
30
"messageId": "abcdef12-3456-7890-abcd-ef1234567890",
31
"ReceiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a..."
32
}
33
],
34
"errors": []
35
}

Send Message
Copy

Send a message to an SQS queue

Sample Input

1
{
2
"queue_name": "my-sqs-queue",
3
"queue_type": {
4
"delay_seconds": 30
5
},
6
"body": "This is a sample message for SQS",
7
"message_attributes": {
8
"priority": "high",
9
"department": "sales"
10
}
11
}

Sample Output

1
{
2
"ResponseMetadata": {
3
"RequestId": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p"
4
},
5
"MD5OfMessageBody": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
6
"MD5OfMessageAttributes": "q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2",
7
"MessageId": "12345678-90ab-cdef-ghij-klmnopqrstuv",
8
"SequenceNumber": "987654321"
9
}