# Configure Your Environment

# Spin up Prefect Core's server

Spinning up the Prefect Core server requires:

Once installed, we first need to ensure that Prefect is configured to look for a local backend:

prefect backend server

Next, we can spin up all the necessary infrastructure, including a PostgreSQL database and the Prefect UI with:

prefect server start

To confirm everything is working, navigate to http://localhost:8080 and you should see the UI!

Switch between a local server and Cloud

You can use the prefect backend CLI command to toggle between a local server and Prefect Cloud.

# Authenticating with Prefect Cloud Cloud

Interacting with the Prefect Cloud API requires the use of JWT tokens for secure authentication.

# Log in to Prefect Cloud

Before you are able to use the many features of Prefect Cloud, you'll need to authenticate your local machine. This is achievable by retrieving a Personal Access Token from the UI and providing it to the Prefect Command Line Interface.

To obtain a Personal Access Token, navigate to https://cloud.prefect.io and through the hamburger menu in the top left corner go User -> Personal Access Tokens -> Create A Token.

Lastly, authenticate your machine with Prefect Cloud:

prefect auth login -t <COPIED_USER_TOKEN>

CLI not installed

If the prefect command is not found then Prefect may not be installed. Go here for instructions on how to install Prefect.

# Create a Runner Token

Running deployed Flows requires an Agent being authenticated against Prefect Cloud. To do this, let's generate a RUNNER-scoped API token:

prefect auth create-token -n my-runner-token -s RUNNER

Keep this runner token handy for future steps, or store it as an environment variable:

export PREFECT__CLOUD__AGENT__AUTH_TOKEN=<COPIED_RUNNER_TOKEN>