Reputation: 67
I have a lambda function lambda1
that gets triggered by an API call and computes the parameters for another job downstream that will be handled by a different function lambda2
.
The resources required to complete the downstream job are not available immediately and will become available at some future time datetime1
which is also calculated by lambda1
.
How do I make lambda1
schedule a message in an SNS topic that will be sent out at datetime1
instead of going out immediately? The message sent out at the correct time will then trigger lambda2
which will find all the resources in place and execute correctly.
Is there a better way of doing this instead of SNS?
Both lambda1
and lambda2
are written in Python 3.8
Upvotes: 0
Views: 685
Reputation: 3802
You would be better off using the AWS Step Functions. Step functions are generally used for orchestrating jobs with multiple Lambda functions involved and they support the wait state
that you need to run a job at a specific time.
Basically, you will create multiple states. One of the states will be wait state
where you will input the wait condition (timestamp at which it will stop waiting). This is what you will send from Lambda1. The next state would be task state
which will be your Lambda2.
Upvotes: 1