0

Into simple AWS Lambda PowerShell script I'm passing parameter called tokens in JSON form:

{ "tokens": "ABC123" }

This is being read by Script as variable $LambdaInput.tokens which is expected by Lambda script by design.

Inside Step Function template I have specified Parameter tokens:

  {
    "Comment": "Start Script",
    "StartAt": "PowerShellScript1",
    "States": {
      "PowerShellScript1": {
        "Type": "Task",
        "Resource": "arn:aws:states:::lambda:invoke",
        "Parameters": {
          "FunctionName": "arn:aws:lambda:XYZ:function:PowerShellScript1:$LATEST",
          "Payload": {
            "Input": {
              "tokens": "ABC123"
            }
          }
        },
        "End": true,
        "TimeoutSeconds": 60
      }
    }
  }

Unfortunately my Lambda script can't recongnize the parameter. I expect it's not being inserted as variable $LambdaInput.tokens.

Is there different Input variable for PowerShell script from Step Functions than from simple Lambda?

Thank you.

2
  • 1
    Look at option 2 I specified in this answer: stackoverflow.com/a/60514998/9115027 see if using that format you are able to get the parameters Commented Mar 26, 2020 at 19:17
  • I used your advice in option 2 and it works! Thanks @Joe Commented Mar 26, 2020 at 21:13

1 Answer 1

0

Thanks to Joe's comment leading to his answer here I managed to form the appropriate definition of State Machines to pass the Parameter to PowerShell Lambda script:

{
  "Comment": "Start Script",
  "StartAt": "PowerShellScript1",
  "States": {
    "PowerShellScript1": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:XYZ:function:PowerShellScript1:$LATEST",
      "Parameters": {
        "tokens": "ABC123"
      },
      "End": true
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.