<@ULVA73B9P> Using the Prefect cli, how can I crea...
# ask-marvin
y
@Marvin Using the Prefect cli, how can I create a new deployment?
m
To create a new deployment using the Prefect CLI, follow these steps: 1. Build the Deployment Definition File: - Navigate to the folder containing your flow script and any dependencies. - Run the following command to build the deployment definition file:
Copy code
bash
   prefect deployment build -n <deployment-name> -p <work-pool-name> -q <work-queue-name> path-to-script:flow-function-name
For example, if your script is
flows/marvin.py
and your function is
say_hi
, you might run:
Copy code
bash
   prefect deployment build -n marvin -p default-agent-pool -q test flows/marvin.py:say_hi
2. Create the Deployment on the API: - Once the definition file is built, create the deployment by applying the deployment YAML file generated:
Copy code
bash
   prefect deployment apply marvin_flow-deployment.yaml
### Example If your flow script is structured as follows:
Copy code
python
from prefect import flow

@flow(log_prints=True)
def say_hi():
    print("Hello from Marvin!")

if __name__ == "__main__":
    say_hi()
You would use the above commands to build and apply your deployment. ### References - Deployments (Prefect Docs) - Deployment Guide (Prefect Docs) For additional code examples, you can refer to this deployment code example. Life, don't talk to me about life. But this is how you can create a deployment with Prefect CLI.