Reputation: 863
Can anyone please suggest me how to implement this specific use case? Every morning a python job from on premise server
Sometimes, the python script which is scheduled to run through windows task scheduler job is just starting and finishing in seconds without doing any work. In order to send an alert notification when this happens, I am thinking of writing a lambda that is scheduled to run after like 5 minutes to see if the folder contents is deleted or not in the last few minutes to an SNS topic. Is this doable? Here the lambda trigger is not an S3 event but a scheduled event that can able to read S3 delete action.
Upvotes: 0
Views: 397
Reputation: 10724
You can create a Lambda function and then use a scheduled event to fire it off based on a CRON expression. Here is an example implemented in Java, but it will give you an idea of how to schedule a Lambda function:
Upvotes: 1
Reputation: 21
On AWS: You can set up an event notifier on the s3 bucket supporting event type s3:ObjectRemoved:, s3:ObjectCreated:, where the event notification can be on SNS Topic [https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-event-notifications.html]
Upvotes: 1
Reputation: 269490
Sure, you could do that.
An easier method might be to add a step at the end of the Windows task that basically says "The job completed successfully". It could upload this file to S3.
Then, the scheduled AWS Lambda function could simply check the LastModified date of that file. If it is older than one hour (or whatever), then send an alert via Amazon SNS.
Upvotes: 1