RustyShackleford
RustyShackleford

Reputation: 3667

How to trigger lambda after completion of another lambda?

I have two python scripts that I want to run one after another.

Script1 has a trigger on a S3 bucket. After script1 is done, I want to immediately trigger script2.

I am not finding how to set this trigger, but am finding how to chain lambdas and trigger them from inside script1. I think I do not want this. Open to all suggestions.

Upvotes: 3

Views: 1222

Answers (2)

Traycho Ivanov
Traycho Ivanov

Reputation: 3207

If you plan to have a flow of lambdas please check Step Functions - https://aws.amazon.com/step-functions/. You could define a flow to invoke next lambda by a state condition.

As Mark said there could be other way with combination of SQS or SNS.

Upvotes: 0

Mark B
Mark B

Reputation: 200562

You're looking for a Lambda trigger based on the "Function Invocation Finished" event. This isn't something natively supported by AWS as far as I'm aware. If you want to keep the functions decoupled, I would have the first function post to an SNS topic whenever it completes, and then have your 2nd function subscribe to that SNS topic.

Upvotes: 2

Related Questions