Hi team! Im trying to figure out the easiest way t...
# ask-community
s
Hi team! Im trying to figure out the easiest way to trigger a no-changes-to-the-defaults flow run when a cloudwatch trigger happens. Ie someone uploads a file into s3, and that triggers a prefect flow run which is designed to download that file, process it, and stick it somewhere else. Are there any existing patterns of plugins which would make this easy to do instead of our default solution (cloudwatch triggers a lambda). I notice you can trigger a flow run via the REST API, but the example request (https://docs.prefect.io/2.10.16/api-ref/rest-api-reference/#tag/Flow-Runs/operation/create_flow_run_flow_runs__post) is… massive.
1
r
For the REST API, "Create Flow Run From Deployment" might be useful if you have the flow you want to run deployed somewhere: https://docs.prefect.io/2.10.16/api-ref/rest-api-reference/#tag/Deployments/operation/create_flow_run_from_deployment_deployments__id__create_flow_run_post I think the only thing actually required is the deployment ID. I just tried it with an empty JSON object in the request body and it created a new flow run using the deployment's defaults. If you're using Prefect Cloud you can probably also trigger your flow with a webhook.
n
yeah a webhook would be my recommendation, i guess from a lambda might be easiest, which sounds like it might not be so practically different from your status quo, but you would have that event
s3.blob.created
(or something) in the event feed you could use as a hook for anything, including the trigger of a
Run Deployment
automation, passing along the blob ref in the
body
of the webhook
👍 1
s
Ah its good to know that only the deployment ID is needed. I bounced off that REST call initially because the sheer number of parameters I thought I needed to find was insane