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.
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 ?
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.
I assume you have processing you didn't mention that takes so long that you can't add multiple books in one invocation of the lambda function.
You can both fanout and recursively invoke your lambda function. There are benefits and drawbacks to both.
If you fanout to too many, too often, your dynamodb writes could spike above provisioned write capacity.
If you recursively call your function you will not be able to return a value to the caller. (Assuming that the whole chain of call takes more than five minutes.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With