Reputation: 51
I'm in the process of migrating an existing NodeJS application to run as a Lambda function. So far I've identified that the main function which sends an HTTP POST request can be placed into a Lambda function, however, this function is invoked via a For Loop in which after each iteration has a random delay. The For Loop's iteration count is defined by a user request.
The only way I can think of is having a normal NodeJS process that runs the "Loop" which invokes the lambda. But this defeats the purpose of the serverless/auto-scaling architecture I am trying to create.
Am I able to replace the below for loop & random delay with a serverless/auto-scaling solution?
for (let i = 0; i < userTasks; i++) {
httpRequestLambda();
await delay(); // delay can be anywhere from 5 Seconds to 20 Minutes
}
Upvotes: 0
Views: 652
Reputation: 1532
These are following options you can schedule AWS Lambda;
Overview of option 1) and option 2) is also available on this AWS blog with AWS web-console screen-shots.
Upvotes: 1