<@ULVA73B9P> i have seldthost prefect remotely wit...
# marvin-ai
m
@Marvin i have seldthost prefect remotely with exs workee but how to test locally without hassle changing api to local and remote
m
thought for 316.4 seconds
Great question — the easiest way to switch between your remote self-hosted Prefect and a local test setup without editing code or changing env vars constantly is to use Prefect profiles. In Prefect 3.x, profiles let you pin settings like
PREFECT_API_URL
and
PREFECT_API_KEY
per environment, then switch with a flag or an env var. Quick setup 1) Create a “remote” profile (points to your self-hosted server)
Copy code
prefect profile create remote
prefect profile use remote
prefect config set PREFECT_API_URL=https://<your-remote-host-or-domain>/api PREFECT_API_KEY=<your-key>
2) Create a “local” profile (points to a local server if you run one)
Copy code
prefect profile create local
prefect profile use local
prefect config set PREFECT_API_URL=<http://127.0.0.1:4200/api>
# If your local server has no auth:
prefect config unset PREFECT_API_KEY
How to switch without hassle - For a single command, use the CLI flag:
Copy code
prefect --profile remote work-pool ls
prefect --profile local server start
prefect --profile local deploy
- For a whole shell/session, use an env var:
Copy code
PREFECT_PROFILE=remote python flow.py
PREFECT_PROFILE=local python flow.py
(Windows PowerShell:
$env:PREFECT_PROFILE = "remote"
) - Or set the default once and forget it:
Copy code
prefect profile use remote
# later
prefect profile use local
Helpful commands - List profiles:
prefect profile ls
- Inspect current profile settings:
prefect profile inspect
- View the resolved config:
prefect config view
Notes for your setup - Don’t hardcode API URLs in code; rely on the active profile and let Prefect’s client pick it up automatically. - You can keep your ECS work pool for remote runs; to test locally, either: - Run the flow directly (no server needed):
python your_flow.py
- Or connect a local process worker to your remote server by using the
remote
profile, then start a local “process” worker and run against the same work pool. Docs - Profiles and settings in Prefect 3.x: Settings and profiles If you share your current
PREFECT_API_URL
for the remote server, I can give you the exact commands with your values filled in.