AWS Step Functions の配列内で jsonPath を使用する方法 質問する

AWS Step Functions の配列内で jsonPath を使用する方法 質問する

私はAWSのステップ関数を書いています。ステップの1つで、入力の1つとして配列を受け入れるラムダを呼び出したいのですが、配列にJsonPathを渡そうとすると、

The value for the field 'arrayField.$' must be a STRING that contains a JSONPath but was an ARRAY

私のステップ関数の定義:

{
  "StartAt": "First",
  "States": {
  "First": {
    "Type": "Pass",
    "Parameters": {
      "type": "person"
    },
    "ResultPath": "$.output",
    "Next": "Second"
  },
    "Second": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:<aws_id>:function:MyFunction",
      "Parameters": {
        "regularParameter": "some string",
        "arrayParameter.$": ["$.output.type"]
      },
      "Next": "Succeed"
    },
    "Succeed": {
      "Type": "Succeed"
    }
  }
}

配列内で jsonPath を使用するにはどうすればよいですか?

ベストアンサー1

新しいリリース以降では、組み込み関数を使用できますStates.Array:

  "arrayParameter.$": "States.Array($.output.type)"

詳しくは、amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html をご覧ください。

おすすめ記事