Using the prefect-cloud CLI, you can deploy any Python script that’s available in a GitHub repository and run it on a schedule in the cloud for free in a few simple steps.

Prerequisites

You’ll need the following to get started with Prefect Cloud: Next, open a terminal and execute the commands in the following steps to deploy and run your script in Prefect Cloud.
1

Log in to Prefect Cloud

uvx prefect-cloud login
2

Connect to GitHub

uvx prefect-cloud github setup
3

Deploy your workflow

Select a function in your script as the entrypoint for your workflow, and provide the path to it from the root of your repository. Your entrypoint should be the “main” function of your script — the function that’s called first when you run your script locally.
uvx prefect-cloud deploy <path/to/script.py:entrypoint_function_name> \
    --from <github-account>/<repo-name> \
    --name <deployment_name>
prefect-cloud deploy has a few helpful options, like adding Python dependencies to your deployment and setting the default parameter values for your entrypoint function.
If you don’t have a script to deploy, you can use this example:
uvx prefect-cloud deploy examples/hello.py:hello_world \
    --from PrefectHQ/prefect-cloud \
    --name github_quickstart
4

Run your deployment

uvx prefect-cloud run <flow_name>/<deployment_name>
If using the example script, run:
uvx prefect-cloud run hello_world/github_quickstart
5

Schedule your deployment

Prefect Cloud can run your deployment on a schedule if you provide a cron expression like 0 * * * * for hourly runs or 0 0 * * * for daily runs at midnight.
uvx prefect-cloud schedule <flow_name>/<deployment_name> <SCHEDULE>
If using the example script, run the following command to schedule your deployment to run hourly:
uvx prefect-cloud schedule hello_world/github_quickstart "0 * * * *"
6

View your runs in Prefect Cloud

Visit the Prefect Cloud dashboard to see the status of your runs.

Cleanup

To remove schedules from your deployment, run:
uvx prefect-cloud unschedule <flow_name>/<deployment_name>
To delete a deployment, run:
uvx prefect-cloud delete <flow_name>/<deployment_name>

Next steps

Prefect offers much more than simple code deployment and scheduling. Install the prefect Python package in your development environment, and explore the following topics: