# Overview and Setup

Welcome to the Prefect Deployment Tutorial! This tutorial will cover:

If you haven't yet, you might want to go through the Prefect Core Tutorial, which covers in greater detail how to write Prefect Flows.

# Install Prefect

Before starting the tutorial, you'll need a working install of the core Prefect library.

You can find installation instructions here.

# Select an Orchestration Backend

Prefect supports two different orchestration backends:

To use Prefect with either backend, you must first select that backend via the CLI:

$ prefect backend cloud
$ prefect backend server

Note that you can change backends at any time by rerunning the prefect backend ... command.

# Authenticating with Prefect Cloud Cloud

If you're using Prefect Cloud, you'll also need to authenticate with the backend before you can proceed further.

# Create an API Key

To authenticate, you'll need to create an API Key and save it.

  • Login to https://cloud.prefect.io
  • Navigate to the API Keys page. In the User menu in the top right corner go to Account Settings -> API Keys -> Create An API Key.
  • Copy the created key
  • Save the key locally either in your ~/.prefect/config.toml config file, or as an environment variable:
# ~/.prefect/config.toml
[cloud]
auth_token = <API_KEY>
export PREFECT__CLOUD__AUTH_TOKEN=<API_KEY>

# Create a Service Account Key

Running deployed Flows with an Agent also requires an API key for the Agent. You can create one in the Service Accounts page of the UI.

You'll need this token later in the tutorial. You can save it locally either in your ~/.prefect/config.toml config file, or as an environment variable:

# ~/.prefect/config.toml
[cloud.agent]
auth_token = <SERVICE_ACCOUNT_API_KEY>
export PREFECT__CLOUD__AGENT__AUTH_TOKEN=<SERVICE_ACCOUNT_API_KEY>