Call Amazon SQS with Step Functions - AWS Step Functions

Call Amazon SQS with Step Functions

Step Functions can control certain AWS services directly from the Amazon States Language. For more information about working with AWS Step Functions and its integrations, see the following:

Supported Amazon SQS APIs:


There is a quota for the maximum input or result data size for a task in Step Functions. This restricts you to 262,144 bytes of data as a UTF-8 encoded string when you send to, or receive data from, another service. See Quotas related to state machine executions.

The following includes a Task state that sends an Amazon Simple Queue Service (Amazon SQS) message.

{ "StartAt": "Send to SQS", "States": { "Send to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage", "Parameters": { "QueueUrl": "", "MessageBody.$": "$.input.message", "MessageAttributes": { "my attribute no 1": { "DataType": "String", "StringValue": "attribute1" }, "my attribute no 2": { "DataType": "String", "StringValue": "attribute2" } } }, "End": true } } }

The following includes a Task state that publishes to an Amazon SQS queue, and then waits for the task token to be returned. See Wait for a Callback with the Task Token.

{ "StartAt":"Send message to SQS", "States":{ "Send message to SQS":{ "Type":"Task", "Resource":"arn:aws:states:::sqs:sendMessage.waitForTaskToken", "Parameters":{ "QueueUrl":"", "MessageBody":{ "Input.$":"$", "TaskToken.$":"$$.Task.Token" } }, "End":true } } }

To learn more about receiving messages in Amazon SQS, see Receive and Delete Your Message in the Amazon Simple Queue Service Developer Guide.

For information on how to configure IAM when using Step Functions with other AWS services, see IAM Policies for Integrated Services.