Greg Roche

    Greg Roche

    2 years ago
    Hi folks! I have local machine with Prefect installed, which has executed a flow, and I've set up Prefect Server on an EC2 instance (with the backend set to
    server
    ). I'm now trying to set up an agent on my local machine which would be able to communicate with the server on EC2, so I can execute and monitor the flow from the UI. When I try to run
    prefect agent start local --api <http://my.ec2.prefect.ip:4200/graphql>
    on my local machine, it fails with
    No agent API token provided
    . In the server UI I don't see any options to create tokens and if I try to run
    prefect auth create-token
    it fails with
    Error: Auth commands with server are not currently supported
    , I guess because generating tokens is a Cloud-only feature. So my question is: how would I be able to set up a relationship between my local machine, where the flow would be running, and the server, without using Prefect Cloud? If that's not possible, would I be able to have the flow present on the same machine as the server and just use
    flow.register(project_name="project_name_in_prefect_server")
    in my flow script to have it managed by the server, or are there more steps involved?
    j

    josh

    2 years ago
    Hey @Greg Roche that authorization warning on the agent only happens when the backend is set to
    cloud
    . You mentioned that you have your backend set to
    server
    but could you verify that again?
    Greg Roche

    Greg Roche

    2 years ago
    Thanks for the quick reply - I just terminated the server, ran
    prefect backend server
    and restarted the server, and I'm still getting the same errors when running
    prefect auth create-token
    on the server and
    prefect agent start local --api <http://my.ec2.prefect.ip:4200/graphql>
     on my local machine.
    j

    josh

    2 years ago
    The
    auth
    commands only work against Cloud and you shouldn’t need to call them. On your local machine are you also calling
    prefect backend server
    ?
    Greg Roche

    Greg Roche

    2 years ago
    I wasn't, that worked, thanks very much! It seems like all I need to do now is to register the flow in my script with
    flow.register("foo")
    and then start the local agent with
    prefect agent start local --api <http://my.ec2.prefect.ip:4200/graphql> --label foo
    and the server will start tracking the flow through that agent?
    j

    josh

    2 years ago
    Yep!
    Greg Roche

    Greg Roche

    2 years ago
    Thanks a lot for your help 😃