You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS CDK:能否为LambdaInvoke的InputPath属性传入多个JSON路径?

更高效的实现方式

完全可以省去中间的Pass状态,直接在LambdaInvoke中通过payload属性构造所需的输入对象,无需额外的状态节点。

示例代码

this.augmentProductIdArray = new LambdaInvoke(this, "Add the Product ID To The Array", {
  lambdaFunction: lambdaFunctionLocation,
  payload: {
    "array": JsonPath.stringAt("$.productIdsArray"),
    "value": JsonPath.numberAt("$.productId.id")
  },
  // 若需要保留原始event,可按需设置resultPath,否则默认会用Lambda执行结果替换整个event
  // resultPath: "$.augmentResult",
});

说明

  • LambdaInvoke的payload属性支持直接传入包含JsonPath表达式的对象,Step Functions会自动解析这些表达式并组装出最终的输入传递给Lambda函数。
  • 这种方式减少了状态机的节点数量,简化了流程逻辑,同时降低了状态机的执行开销(省去了额外的Pass状态执行步骤)。

内容的提问来源于stack exchange,提问作者Luke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 01:36:30