pradana adnyana
05/22/2026, 9:48 AMMarvin
05/22/2026, 9:48 AMMarvin
05/22/2026, 9:50 AMprefect.yaml
Best if you want deployments tracked in git / CI.
yaml
prefect-version: 3
deployments:
- name: flow-a-deployment
entrypoint: flows/flow_a.py:flow_a
work_pool:
name: my-work-pool
- name: flow-b-deployment
entrypoint: flows/flow_b.py:flow_b
work_pool:
name: my-work-pool
- name: flow-c-deployment
entrypoint: flows/flow_c.py:flow_c
work_pool:
name: my-work-pool
Then deploy them all with:
bash
prefect deploy --all
Or deploy selected ones:
bash
prefect deploy --name flow-a-deployment --name flow-b-deployment
2. Using Python with deploy()
Useful if you want to define deployments in code.
python
from prefect import flow, deploy
@flow
def flow_a():
print("A")
@flow
def flow_b():
print("B")
if __name__ == "__main__":
deploy(
flow_a.to_deployment(name="flow-a-deployment"),
flow_b.to_deployment(name="flow-b-deployment"),
work_pool_name="my-work-pool",
image="my-image:latest",
)
A few important notes:
- Each flow can have one or more deployments.
- In Prefect Cloud, deployments show up under their corresponding flow.
- If you use prefect.yaml, prefect deploy --all is usually the easiest approach for multiple flows in one repo.
- If all flows use the same runtime/image/work pool, defining them together is very convenient.
If your flows are in the same repository, I’d usually recommend prefect.yaml + prefect deploy --all.
Useful docs:
- Deployments docs
- Work pools docs
- prefect.yaml guide
If you want, I can give you a complete example project structure for deploying 2–3 flows to Prefect Cloud.