Recursive invocations / fork invocations in AWS Lambda

Viewed 1395

I'm using AWS Lambda in NodeJS. With this lambda, I want to add a book in DynamboDB. It works fine.

Now, I want to do it for a list of books. I have some ideas but I don't know if it's possible in AWS lambda.

idea 1 : fork several lamba

I'm wondering if it's possible to have a "master" Lambda that have a list of books to add, and foreach books invoke a lambda function "insert book". The maximum timeout is 5 minutes so it's possible to make an asynchronous invocation from the "master" lambda in order to not wait for all forked lambda process ?

idea 2 : recursive invocations

Create a generic lambda that process the first book of a list of books passed as input. At the end of the process, remove the book from the list (if OK) and invoke the same lambda with the updated List.

Note : the first invocation need to get the list of books.

Many thanks for your help !

Romain.

3 Answers
Related