I am creating a step function for running an ETL job when ever files are uploaded into DB. The step function involves tasks like glue jobs, crawler runs lambdas etc.
I have different clients that upload data to their respective s3 buckets and each client have their own resources like crawlers etc. and I have to execute the respective resources based on each client.
So, here in order to dynamically pick up the resource I have created a lambda to give the configurations that has these resources name. I am calling this in the first step and is it possible to refer this first states output in all other states.
Sample step function model : s3_uploaded –> get_configurations –> invoke_crawler_in get_configurations –> invoke job from get_configurations.
2
Answers
You can use ResultPath to append every state output, preserving the original input.
You use ResultPath to have the output of your state combine the input along with results generated in that state. You then need to maintain that flow through your state machine definition.
In this example, I have four states in serial where the results from 3 of the states are combined with output. While one state sets ResultPath to
null
which causes the results from the state to be ignored and the state to just pass on what it got as input.So if you run this, you will get the following as output:
If you want to learn more, you can read the Step Functions docs on Input and Output Processing or check out the module in the Step Functions workshop.