Hello, I want to create an event driven (when file...
# prefect-community
Hello, I want to create an event driven (when files land in s3) deployment. Is this best way to do this with a lambda function? If so, what's the best documentation to follow on this?
Hi @Ashley Felber I manage it in that way and it's works properly. I create a function to check if the file arrived to S3, that function is executed by a task like the code. I use bucket, path, filename for my function but you can create it with your requirements.
Copy code
      description="This task sensing s3 files")
def s3_sensor(s3_bucket,s3_prefix,s3_filename,incremental):
    logger_run = get_run_logger()

    while True:
        bool_s3_object_arrived = check_if_file_arrived_in_s3(your args)
        if bool_s3_object_arrived is True:
            f"The file has arrived today"
        if bool_s3_object_arrived is False:
            f"Re-schedule the file is not updated"
🙌 1
Thanks. Is there a reason you're doing it this way vs. just triggering the lambda to run when an s3 file is added? Also where are you actually triggering the deployment?