Skip to content

Run Deployments on Serverless Infrastructure with Prefect Workers

Prefect provides hybrid work pools for workers to run flows on the serverless platforms of major cloud providers. The following options are available:

  • AWS Elastic Container Service (ECS)
  • Azure Container Instances (ACI)
  • Google Cloud Run
  • Google Cloud Run V2
  • Google Vertex AI

Work pool options

  • Create a work pool that sends work to your chosen serverless infrastructure
  • Deploy a flow to that work pool
  • Start a worker in your serverless cloud provider that will poll its matched work pool for scheduled runs
  • Schedule a deployment run that a worker will pick up from the work pool and run on your serverless infrastructure

Push work pools don't require a worker

Options for push work pool versions of AWS ECS, Azure Container Instances, and Google Cloud Run that do not require a worker are available with Prefect Cloud. These push work pool options require connection configuration information to be stored on Prefect Cloud. Read more in the Serverless Push Work Pool Guide.

This is a brief overview of the options to run workflows on serverless infrastructure. For in-depth guides, see the Prefect integration libraries:

Choosing between Google Cloud Run and Google Vertex AI

Google Vertex AI is well-suited for machine learning model training applications in which GPUs or TPUs and high resource levels are desired.

Steps

  1. Make sure you have an user or service account on your chosen cloud provider with the necessary permissions to run serverless jobs
  2. Create the appropriate serverless work pool that uses a worker in the Prefect UI
  3. Create a deployment that references the work pool
  4. Start a worker in your chose serverless cloud provider infrastructure
  5. Run the deployment

Next steps

Options for push versions on AWS ECS, Azure Container Instances, and Google Cloud Run work pools that do not require a worker are available with Prefect Cloud. Read more in the Serverless Push Work Pool Guide.

Learn more about workers and work pools in the Prefect concept documentation.

Learn about installing dependencies at runtime or baking them into your Docker image in the Deploying Flows to Work Pools and Workers guide.