Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Let's say I have this state machine in AWS Step Function:

step function example

And I had started it with this input:

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

It's clear for me that Action A is receiving the input payload. But, how can Action C access the state machine input to get the value of item3? Is it possible?

Thanks!!

like image 210
dsicari Avatar asked Sep 18 '25 11:09

dsicari


1 Answers

Typically, the data available in Action C will be dependent on what the result/output of Action B is.

However, if you just care about the original input to the state machine execution, you can set the payload of Action C using the Context Object.

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

Check out the AWS documentation for Context Object

like image 121
deric4 Avatar answered Sep 23 '25 13:09

deric4