3

Is there any way I can have the output of a task decide the next state of the step function? I have a lambda and it is going to have certain outputs. How can I use these outputs to decide the next state ?

Edit: I had initially implemented using Choice states but I have some values that needs to be passed through some states in a loop until specific conditions(takes a few hours to reach) are met. If I include a choice state in that loop , that value gets discarded. I was Using Choice to check the condition and either loop back to previous state or move to the next state and a wait state to pause the step function. The problem is with looping back to the previous state as all the values of the previous state inputs gets discarded in the choice state.

Thanks

1 Answer 1

1

You can use a choice state dependent on the input to the state.

See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html

Sign up to request clarification or add additional context in comments.

4 Comments

I have some values that needs to be passed through some states in a loop until specific conditions are met. If I include a choice state in that loop , that value gets discarded
Add the choice state after the success condition for your loop :)
But I need the choice state to check for the loop termination condition.Was using choice state to either continue the loop or terminate and move to next state. The Choice state gets an input from a lambda function that sends a json with multiple fields. Depending on the output of the lambda the choice will loop back with some delay to the lambda or will move to the next state.
Hi, Just have the default action for the choice state call docs.aws.amazon.com/step-functions/latest/dg/…. This will alllow you to build a loop, with the choice state terminating the loop and progressing when the condition has been met

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.