Lamda functions - How do I loop in AWS-StepFunctions - with Nodejs?

0

I have a lambda function, F1, in Nodejs whose main purpose is to read the contents of a file that is deposited in S3 through another process.

Let's say there are 10 products in this archive. I need to loop through these products to call the F2 function 10 times.

How do I implement this process with StepFunctions ?

    
asked by anonymous 03.08.2018 / 13:50

1 answer

1

According to the documentation you can create a Lambda Function that works as an "Iterator":

Ex:

exports.iterator = function iterator (event, context, callback) {
  let index = event.iterator.index
  let step = event.iterator.step
  let count = event.iterator.count

  index += step

  callback(null, {
    index,
    step,
    count,
    continue: index < count
  });
}
    
03.08.2018 / 15:11