I have two lambda function and both written in Java. Assume A & B.. When A function got successfully executed then I want B function to be executed after 24 hours. Is it possible to achieve? If yes how?
There are multiple ways to achieve this using AWS resources. Here are a few options that can be implemented easily:
Step Functions: In Step Functions, you can utilize the Wait state to control the transition of messages from one Lambda function to another. By configuring appropriate wait times, you can achieve the desired delay between the execution of Lambda function A and Lambda function B.
SQS: Another approach is to trigger Lambda function B using SQS messages. However, note that the maximum visibility timeout for SQS is limited to 12 hours. To achieve a 24-hour window, you can enable the retry functionality on the SQS. However, in order to trigger the retries, you would need to configure Lambda function B to throw an exception during the first attempt of processing the messages from the SQS queue. This will signal to SQS that the message processing should be retried.