1

I have two lambdas L1 and L2. Iam starting state machine in L1. I have environment variable for L1 i.e.,E1. Basically E1 is list of space separated values for which I need to do some Hashfunction in L1 and for each value I need to trigger a separate instance of Lambda L2 with that value and Hash(value) as input

eg: E1 - "1 2 3" and hash(1) = stack, hash(2) = over, hash(3) = flow Three instances of L2 should be triggered with (i, hash(i)) as input/payload to L2

How to achieve this using step functions

1 Answer 1

1

You can do this by using a Map state. The easiest way would be to have the output of the first function be an array of the inputs to the second. So something like this:

[
  {
    i: 1,
    iHash: 'hashed 1'
  },
  {
    i: 2,
    iHash: 'hashed 2'
  }
  .
  .
  .
]

In the Map state you set the iterator value to the array from the output. The value of each element of the array will be the input to the first state inside the Map state. Inside the Map state you just need to have another Task state that is your second Lambda function, and pass in $ to the Payload.

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

Comments

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.