Lamda functions - How do I loop AWS-Stepfunctions - with Nodejs?

Asked

Viewed 29 times

0

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

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

How do I implement this process with Stepfunctions?

  • It is. So it looks like q are 3 functions. The iterator is a separate function. I was imagining 2 functions. One to retrieve and loop and another function to do the task. put the solution.

1 answer

1


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

inserir a descrição da imagem aqui

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
  });
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.