Step Function with SQS

Let’s quickly create a Queue using all the default values

image.png

image.png

Let’s copy the URL (not ARN) :

image.png

Create a State Machine in Step Function

image.png

Pass this ASL : (make sure to replace the QueueURL)

image.png

{
  "Comment": "Transaction Processor State Machine Using SQS",
  "StartAt": "ProcessTransaction",
  "States": {
    "ProcessTransaction": {
      "Type": "Pass",
      "Next": "BroadcastToSqs"
    },
    "BroadcastToSqs": {
      "Type": "Task",
      "Resource": "arn:aws:states:::sqs:sendMessage",
      "Parameters": {
        "QueueUrl": "<https://sqs.us-east-1.amazonaws.com/967277549983/SQSFromStepFunction>",
        "MessageBody": {
          "TransactionId.$": "$.TransactionId",
          "Type.$": "$.Type"
        }
      },
      "End": true
    }
  }
}

Input would be :

{
	"TransactionId": "abc",
	"Type": "PURCHASE"
}

Basically,