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:- A free Prefect Cloud account
- A free GitHub account
- uv installed on your system
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.
If you don’t have a script to deploy, you can use this example:
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.Add dependencies
Add dependencies
Add individual Python dependencies by including their package name.Include dependencies from a requirements file by providing the path to the file from the root of your repository.
Set parameter defaults
Set parameter defaults
If your entrypoint function has parameters, you can assign the default values used by your deployment.
Include environment variables
Include environment variables
Include key-value pairs that will be available as environment variables when your deployment runs.
Include secrets
Include secrets
Store secrets in Secret Prefect blocks that will be loaded as environment variables by name reference when your deployment runs.
Blocks are encrypted, helping avoid storing secret values as plaintext properties on your deployment.Reference existing Secret blocks by name.
Select Python version
Select Python version
Select the version of Python to run your script on.
Supported Python versions include
3.9, 3.10, 3.11, and 3.12.Run your deployment
Override parameter defaults for a single run
Override parameter defaults for a single run
You can override the inputs to your entrypoint function for ad-hoc runs of your deployment.
Follow run output in your terminal
Follow run output in your terminal
Tail your run’s state changes and log outputs directly in your terminal.
Schedule your deployment
Prefect Cloud can run your deployment on a schedule if you provide a cron expression like
If using the example script, run the following command to schedule your deployment to run hourly:
0 * * * * for hourly runs or 0 0 * * * for daily runs at midnight.Set per-schedule parameter defaults
Set per-schedule parameter defaults
Prefect deployments can have multiple schedules, each with their own default parameter values.
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:Next steps
Prefect offers much more than simple code deployment and scheduling. Install theprefect Python package in your development environment, and explore the following topics:
- Divide your work into observable units with flows and tasks.
- Automatically rerun workflows on failure with retries.
- Checkpoint workflow progress and skip reruns of completed work with caching.
- Run work concurrently using
.submit()and.map(). - Build a data lineage graph by materializing assets.
- Version your deployments and roll back to working versions when they fail.
- Run flows on your own infrastructure in custom work pools.