<@ULVA73B9P> how to deploy multiple flow in prefec...
# ask-marvin
p
@Marvin how to deploy multiple flow in prefect cloud?
m
thought for 109.6 seconds
You can deploy multiple flows to Prefect Cloud in Prefect 3.x in two common ways: 1. Using
prefect.yaml
Best if you want deployments tracked in git / CI.
Copy code
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:
Copy code
bash
prefect deploy --all
Or deploy selected ones:
Copy code
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.
Copy 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.