AWS-SSM Automation Documents: Is it possible to send a StringList output to a Lambda as payload?

1.4k views Asked by At

In an SSM Automation document, I am trying to send a StringList output from a step as an input Payload to my Lambda in another step. I have made sure that the output is in fact a StringList, but when it is received as an input to the Lambda, it is received only as one of the items in the list(the first item). Any idea why this might be happening?

mainSteps:
  - name: GetUserInlinePolicies
    action: 'aws:executeAwsApi'
    inputs:
      Service: iam
      Api: list_user_policies
      UserName: '{{UserName}}'
    outputs:
      - Name: InlinePolicies
        Selector: $.PolicyNames
        Type: StringList
  - name: RemoveUserPolicies
    action: 'aws:invokeLambdaFunction'
    maxAttempts: 1
    timeoutSeconds: 500
    inputs:
      FunctionName: remove-user-inline-policies
      Payload: '{"userName":"{{UserName}}", "policies":"{{GetUserInlinePolicies.InlinePolicies}}}"'
    isEnd: true
1

There are 1 answers

0
Ali Fahmy On BEST ANSWER

I am still unable to send the StringList as a parameter within the JSON Payload input. However, I was able to successfully send it under InputPayload as follows:

inputs:
  FunctionName: remove-user-inline-policies
  InputPayload:
    userName: '{{UserName}}'
    policies: '{{GetUserInlinePolicies.InlinePolicies}}'