There are several ways to create deployments, each catering to different organizational needs.Documentation Index
Fetch the complete documentation index at: https://docs.prefect.io/llms.txt
Use this file to discover all available pages before exploring further.
Create deployments with static infrastructure
Create a deployment with serve
This is the simplest way to get started with deployments:
serve method creates a deployment from your flow and immediately begins listening for scheduled runs to execute.
Providing cron="* * * * *" to .serve associates a schedule with your flow so it will run every minute of every day.
Create deployments with dynamic infrastructure
For more configuration, you can create a deployment that uses a work pool. Reasons to create a work-pool based deployment include:- Wanting to run your flow on dynamically provisioned infrastructure
- Needing more control over the execution environment on a per-flow run basis
- Creating an infrastructure template to use across deployments
Create a deployment with deploy
To define a deployment with a Python script, use the flow.deploy method.
Here’s an example of a deployment that uses a work pool and bakes the code into a Docker image.
deploy method, see Deploy flows with Python.
Create a deployment with a YAML file
If you’d rather take a declarative approach to defining a deployment through a YAML file, use aprefect.yaml file.
Prefect provides an interactive CLI that walks you through creating a prefect.yaml file:
prefect.yaml file for deployment creation.
The file contains build, push, and pull steps for building a Docker image, pushing code to a Docker registry, and pulling code at runtime.
Learn more about creating deployments with a YAML file in Define deployments with YAML.
Prefect also provides CI/CD options for automatically creating YAML-based deployments.