如何在 AWS Step Functions 的任何节点中访问状态机的输入

How to access input of state machine in any node at AWS Step Functions

假设我在 AWS Step Function 中有这个状态机:

我是用这个输入启动它的:

{
  "item1": 1,
  "item2": 2,
  "item3": 3
}

我很清楚 Action A 正在接收输入负载。但是,Action C 如何访问状态机输入以获得 item3 的值?可能吗?

谢谢!!

通常,Action C 中可用的数据将取决于 Action B 的 result/output 是什么。

但是,如果您只关心状态机执行的原始输入,您可以使用 Context Object.[=15 设置 Action C 的负载=]

// roughly 
 "Action C": {
   "Type": "Task",
   "Resource": "arn:aws:states:::lambda:invoke",
   "Parameters": {
     "Payload.$": "$$.Execution.Input",
     "FunctionName": "<action c lambda>"
 },

查看 AWS documentation for Context Object