No results for

Powered byAlgolia
⚠️ This documentation is outdated. Please visit for the latest k6 documentation.📚


SQSClient.sendMessage(queueUrl, messageBody, options) sends a message to the specified Amazon Simple Queue Service (SQS) queue.


queueUrlstringThe URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.
messageBodystringThe message to send. The minimum size is one character. The maximum size is 256 KB.
optionsSendMessageOptions (optional)Options for the request.


messageDeduplicationIdstring (optional)The token used for deduplication of sent messages. This parameter applies only to FIFO (first-in-first-out) queues. If a message with a particular MessageDeduplicationId is sent successfully, any messages with the same MessageDeduplicationId are accepted but not delivered during the 5-minute deduplication interval.
messageGroupIdstring (optional)The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner. Messages in different message groups might be processed out of order.
messageAttributesobject (optional)Each message attribute consists of a Name, Type, and Value. For more information, see Amazon SQS Message Attributes.
delaySecondsnumber (optional)The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive delaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies.


Promise<object>A Promise that fulfills with the message that was sent, as an object containing an id string property holding the unique identifier for the message, and a bodyMD5 string property holding the MD5 digest of the non-URL-encoded message body string.


import exec from 'k6/execution'
import { AWSConfig, SQSClient } from ''
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
sessionToken: __ENV.AWS_SESSION_TOKEN,
const sqs = new SQSClient(awsConfig)
const testQueue = ''
export default async function () {
// If our test queue does not exist, abort the execution.
const queuesResponse = await sqs.listQueues()
if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) {
// Send message to test queue
await sqs.sendMessage(testQueue, 'test', {
messageAttributes: {
'test-string': {
type: 'String',
value: 'test'
'test-number': {
type: 'Number',
value: '23'
'test-binary': {
type: 'Binary',
value: 'dGVzdA=='