-1

I want to create a file watcher script that detects if the files in S3 folder have been refreshed or not. If yes, then it should execute a particular command in Unix. Please help me with this.

Mihir Garg
  • 29
  • 3

2 Answers2

2

What you need to do is to create a listener (a Lambda function) that will "listen" to the bucket changes. The available events can be found here.

So your code will be notified for every change you have asked to be notified about.
See here how to configure the bucket to fire the events.

Note that nothing will run on your Unix box. Your code will run on AWS and will execute your logic from AWS.

balderman
  • 22,927
  • 7
  • 34
  • 52
0

I create a python script that uses boto3 to get the object details. Then I extracted the timestamp from the object details and then I compare it with the previous timestamp or with my current timestamp. By this, I can know if the files are modified or not. If the file is modified I fire simple command to os which triggers the rest of the python code. To automate the process I created a cron job

Mihir Garg
  • 29
  • 3