I want to check if any files got uploaded in S3.
If there were no file uploads in the last 10 hours, I want to trigger a lambda that can be notified by SNS.
How can I trigger lambda when there were no uploaded file in S3 in last certain hour?
How could I trigger the lambda when there were no files uploaded in the last hour?
First, you need to know when the most recent object was uploaded to S3. That's not a trivial task for a bucket with lots of objects. You could configure S3 to trigger a Lambda function to run every time an object is uploaded and write a 'last-uploaded-time' timestamp to DynamoDB.
Next, you need to schedule the checking of the 'last-uploaded-time' timestamp. You could do that with a CloudWatch/EventBridge scheduled event. Run a Lambda function on a schedule, e.g. every hour.
How can I trigger lambda when there are no uploaded files in s3?