Hi,
I have two lambda function which update the db using flat files trigger from S3. I have third lambda function which insert the data based on previous lambda function but doesn't have any trigger. But i want to trigger the third lambda function when another two lambda executed successfully. Can anyone suggest me the solution using SNS or SQS or SES ??
Are the two lambda functions that update the db triggered at the same time? or in a sequence?
Sheng-Yu Tsai sequence
If you don't mind, call another Lambda asynchronously in the end of the code of the previous lambda will fulfill your requirement.
S3 -> Lambda1 -> Lambda2 -> Lambda3
or more complexly,
S3 -> Lambda1 -> SQS -> Lambda2 -> SQS -> Lambda3
Sheng-Yu Tsai We can go with SQS fifo queue right ?
Sheng-Yu Tsai user will place the file into S3 so it will trigger two lambda function. If two are executed fine then i need to trigger third lambda or anyone is failed i need not trigger third lambda
Bharani Siva yes, FIFO queue is a great option
Cool Venkatesh Balasubramanian Why do we try that ?
Bharani Siva actually two lambda update two different table so once it is executed based on the data in the table i need to execute some store procedure in the third lambda function
Can anyone recommend a lab to test this?
Venkatesh Balasubramanian So you want first two lambda function to execute concurrently and want 3rd lambda function to be executed ?
Bharani Siva crct
First two will be trigger by S3 and third one i don't have any idea
Are the two lambda functions triggered by the same S3 bucket?
Sheng-Yu Tsai no different S3 bucket
Sheng-Yu Tsai can you share any reference link ?? Thanks
Sheng-Yu Tsai i mean for fifo SQS with lambda
If you have to wait for two concurrent lambdas to finish, I think Lambda + FIFO SQS cannot fulfill your need.
check this one. see if this fits
Sheng-Yu Tsai Thanks a lott. I will check that further more deep. Have a good day 😀
Sheng-Yu Tsai this is not a parallel processing it is sequence processing
could you elaborate on which part does not work for your case?
State Function is a one i need to manually execute it right, but actually it should be trigger by putting file into S3
Sheng-Yu Tsai
I mean this is a concept. You have various ways to achieve this idea. Probably you can think about that first by yourself.
Anyway, I'll provide one solution. S3 Bucket1 -> SNS
use the SNS topic to trigger two Lambdas
Venkatesh Balasubramanian Relevant this use case, Step function supports integration with CloudWatch events. You don’t need to execute manually. You can subscribe to S3 CloudWatch event.
I’d have each of the first two write a completion record to either a database or S3. The third function would trigger off either of the first two, and begin by checking for two completion records. If only one is found, it would abort.