dp6000
dp6000

Reputation: 673

How to pass custom variable as input to nested AWS Step Function

I have two Step Functions, where one (Step Function 1) triggers the other (Step Function 2).

The first Step Function has as input:

{
    "ClusterId": "j-AAAAAAA",
    "CreateCluster": false,
    "TerminateCluster": false,
}

My goal is to take the variable ClusterId and pass it Step Function 2. This is how did it:

        "TRIGGER STEP FUNCTION 2": {
          "Type": "Task",
          "Resource": "arn:aws:states:::states:startExecution.sync",
          "Parameters": {
            "StateMachineArn": "arn:aws:states:us-east-1:312312312312123:stateMachine:STEP FUNCTION 2",
            "Input": {
              "ClusterId": "$.ClusterId",
              }
            }
          }

However, the StepFunction 2 input becomes:

{
    "ClusterId": "$.ClusterId",
}

And NOT:

{
    "ClusterId": "j-AAAAAAA",
}

Does anyone know how I can pass the value of ClusterId to StepFunction 2?

Appreciate the help

Upvotes: 0

Views: 854

Answers (1)

dp6000
dp6000

Reputation: 673

Just figured it out. Instead of:

{
    "ClusterId": "$.ClusterId",
}

It should have been:

{
    "ClusterId.$": "$.ClusterId",
}

Upvotes: 1

Related Questions