Map 步骤中的 Step Function 嵌套 Map 步骤

时间:2021-06-06 20:16:31

标签: amazon-web-services nested aws-step-functions

我已经研究步进函数几个星期了。我在我的步骤函数中使用地图状态来迭代数组。该数组还有一个额外的内部数组,因此我想在“外部”映射状态中使用一个附加映射步骤。 AWS documentation 没有深入到这个级别的细节(截至目前),因此,我想分享我设法让它发挥作用。

1 个答案:

答案 0 :(得分:0)

这就是我设法嵌套地图步骤的方式:

"OuterMapState": {
    "Type": "Map",
    "ItemsPath": "$.shipped",
    "MaxConcurrency": 0,
    "Iterator": {
        "StartAt": "Validate",
        "States": {
            "Validate": {
                "Type": "Task",
            "Resource": "arn:aws:lambda:us-east-1:123456789012:function:ship-val",
                "Next": "InnerMapState"
            },
            "InnerMapState": {
                "Type": "Map",
                "ItemsPath": "$.shipped.innerArray",
                "MaxConcurrency": 0,
                "Iterator": {
                    "StartAt": "doSomething",
                    "States": {
                        "doSomething": {
                            "Type": "Pass",
                            "End": true
                        }
                    }
                }
            },
            "End": true
        }
    },
    "End": true
}

祝您使用 AWS Step 函数好运。