shlok
07/14/2025, 10:26 AMMarvin
07/14/2025, 10:26 AMMarvin
07/14/2025, 10:27 AMbash
# Create a profile for your self-hosted instance
prefect profile create self-hosted
prefect config set PREFECT_API_URL="<http://your-self-hosted-url:4200/api>"
# Create a profile for your cloud instance
prefect profile create cloud
prefect config set PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/[account-id]/workspaces/[workspace-id]>"
2. To switch between profiles:
bash
# Switch to self-hosted
prefect profile use self-hosted
# Switch to cloud
prefect profile use cloud
3. To verify which profile you're currently using:
bash
prefect profile ls
Some helpful tips:
- Each profile maintains its own separate configuration
- Your flows, deployments, and other artifacts will be isolated between profiles
- You can have different authentication settings for each profile
- The active profile is indicated with a * in the prefect profile ls
output
If you want to run a single command with a different profile without switching, you can use the --profile
flag:
bash
prefect deployment ls --profile cloud
This way you can seamlessly work with both instances without them interfering with each other. Each profile keeps its own state, authentication, and configuration settings completely separate.shlok
07/14/2025, 10:28 AMMarvin
07/14/2025, 10:28 AMMarvin
07/14/2025, 10:29 AMbash
# Create a new profile for your self-hosted instance
prefect profile create self-hosted
# Copy your current working configuration to the new profile
prefect config set PREFECT_API_URL="<http://127.0.0.1:4200/api>" --profile self-hosted
prefect config set PREFECT_SERVER_ALLOW_EPHEMERAL_MODE="true" --profile self-hosted
2. Create a cloud profile (you'll need your cloud credentials):
bash
# Create cloud profile
prefect profile create cloud
# Set the cloud configuration
# Replace [account-id] and [workspace-id] with your actual values from Prefect Cloud
prefect config set PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/[account-id]/workspaces/[workspace-id]>" --profile cloud
# Log in to cloud (this will prompt you for authentication)
prefect cloud login
3. Now you can switch between them:
bash
# Use self-hosted
prefect profile use self-hosted
# Use cloud
prefect profile use cloud
To verify your configuration at any time:
bash
prefect config view
Since you're currently using an ephemeral profile, it's better to switch to a named profile for more stable configuration management. The ephemeral profile is typically used for temporary settings and testing.shlok
07/14/2025, 10:38 AMMarvin
07/14/2025, 10:38 AMMarvin
07/14/2025, 10:38 AMbash
# Create a new profile for your remote self-hosted instance
prefect profile create remote-server
# Configure it with your remote server's URL
# Replace "your-server-ip-or-domain" with your actual server address
# Make sure to include the /api at the end
prefect config set PREFECT_API_URL="<http://your-server-ip-or-domain:4200/api>" --profile remote-server
# If your remote server requires authentication, set the API key
prefect config set PREFECT_API_KEY="your-api-key" --profile remote-server
# If needed, set the same ephemeral mode setting as your local profile
prefect config set PREFECT_SERVER_ALLOW_EPHEMERAL_MODE="true" --profile remote-server
Now you can switch between your instances:
bash
# Switch to local
prefect profile use self-hosted
# Switch to remote
prefect profile use remote-server
To verify which instance you're connected to:
bash
prefect config view
A few important notes:
- Make sure your remote server is accessible from your machine
- If your remote server uses HTTPS, use https://
instead of http://
- If you're using a different port than 4200, adjust accordingly
- If your remote server is behind a proxy or load balancer, use the appropriate URL