This blog post explains how you can trigger a Prefect flow from AWS Lambda. The Lambda function itself gets deployed using the serverless framework.
It also presents a compelling use case:
- the function gets triggered any time a new file arrives in a given S3 bucket,
- the function checks the file size of the S3 object,
- based on the file size of the S3 object, it allocates more or less memory on your Kubernetes flow run pod to make sure your execution environment has enough memory to process the file (no more OOM errors!),
- at the same time, this strategy prevents overprovisioning resources and can thereby even save costs!