<@ULVA73B9P> When using ECS Push - how can I deplo...
# ask-marvin
b
@Marvin When using ECS Push - how can I deploy multiple flows to the same infrastructure?
m
How to deploy multiple flows to the same ECS infrastructure? Got it. I need to know which version of Prefect you are using to give you the best answer. Can you specify if it's Prefect 2.x or 3.x?
b
@Marvin i'm using 3.x
m
To deploy multiple flows to the same ECS infrastructure in Prefect 3.x, here's a summarized guide: 1. Use the ECS Work Pool: Ensure all flows are associated with the same ECS work pool to deploy them on the same infrastructure. 2. Define Job Variables: Customize your job variables, such as Docker image names and environments, using the
job_variables
parameter in your deployment configuration. 3. Static vs. Dynamic Infrastructure: - Static Infrastructure: If you have flows running regularly, use the
serve
method from the Flow object or the serve utility to manage multiple flows simultaneously. - Dynamic Infrastructure: Deploy the flows dynamically, allowing them to scale horizontally based on need. 4. Deployment Configuration: Use either the UI or CLI to run the deployment configuration. For example:
Copy code
python
    from prefect import flow

    if __name__ == "__main__":
        flow.from_source(
            source="<https://github.com/prefecthq/demo.git>",
            entrypoint="flow.py:my_flow",
        ).deploy(
            name="my-flow",
            work_pool_name="my-ecs-pool",
            job_variables={"pip_packages": ["pandas", "prefect-aws"]},
        )
For more detailed information, you can refer to the ECS guide: - ECS Guide Hope this helps!