Hello! How do we change the prefect_api_url to our...
# prefect-getting-started
d
Hello! How do we change the prefect_api_url to our server host ip in selfhosted prefect. I first ran the command prefect config set PREFECT_API_URL=http://MYHOSTIP:4200/api and then prefect server start, once the prefect server starts, I am seeing it pointed to http://127.0.0.1:4200/api
1
j
hey
PREFECT_API_URL
is the client side setting for where the api is located, you'll want to modify that too. But to change the actual host when starting up the server it's
PREFECT_SERVER_API_HOST
d
So, when I set the prefect_server_host to my EC2 ip and start the prefect server, seeing this errorerror while attempting to bind on address ('MYHOSTIP', 4200): cannot assign requested address Server stopped!
j
I'm pretty sure you want to run it without setting that on the server, and then to connect outside you need to expose the port
i don't think you would set the IP as the host from inside the server with that IP
d
Thank you, so when I try to run the flows using this prefect, I should set this serverapihost variable and port and then run the flow on the prefect instance on the server?
j
Flow runs in your execution environment (like your laptop). You should set
PREFECT_API_URL
there to the publically accessible address of your EC2. On your EC2 you can run your sever, and you need to make sure 1. Your ec2 is accessible to your client side execution environment. 2. The port where your server is running is accessible. For example if you're running the server in a docker container you need to link 4200:4200
d
Ok thanks, we will give a try. The server is opened to the laptop that is running the execution and port also working. We did telnet and were able to confirm both are working
c
If anyone else runs into this, the only way i was able to get this to work was with the following configs in the profiles.toml : PREFECT_API_URL = "http://<My EC2 Public IP>:4200/api" PREFECT_SERVER_API_HOST = "0.0.0.0" Along with opening up the port on the AWS security group.