https://prefect.io logo
Title
t

Taylor Babin

09/19/2022, 4:49 PM
Hello all. I've been trying to deploy prefect 2.0 agent to an ec2 instance and been having issues. I tried following this page however it did not work. https://discourse.prefect.io/t/how-to-deploy-a-prefect-2-0-agent-to-an-ec2-instance-as-your-execution-layer/551 I was able to get the agent to run in the ec2 instance but when I would run a deployment it was just stay stuck on pending. The agent would pick up the flow and submit flow run but wouldn't run. Any help on how to get the agent running will be appreciated. Thank you, Taylor
t

Taylor Curran

09/19/2022, 6:59 PM
hmm Hi Taylor, Have you tried running the same flow locally? Does it still work then?
t

Taylor Babin

09/19/2022, 7:19 PM
Hi, Yes. As of right now I"m just trying to run a 'Hello World" flow. Nothing complicated. Locally I'm able to run and deploy a flow and use an agent.
t

Taylor Curran

09/19/2022, 7:31 PM
I wonder if the agent can’t access your flow code? Where is your flow code stored?
t

Taylor Babin

09/19/2022, 8:12 PM
In the ec2 instance
đź‘Ť 1
Just to restate the flow doesn't fail, it just stays in a pending state.
t

Taylor Curran

09/19/2022, 8:50 PM
I’m not sure, give us some time to do a little research on that we’ll get back to you.
t

Taylor Babin

09/19/2022, 8:52 PM
All good. Thanks for looking into it.
:gratitude-thank-you: 1
Is there any update on this? I noticed it happened to someone else as well https://prefect-community.slack.com/archives/CL09KU1K7/p1663775648891209
t

Taylor Curran

09/22/2022, 6:36 PM
Hi Taylor, I would follow the other thread to see if there are updates. I may be something inside of your flow that is causing this behavior.
Nate is right: (from the other thread) if your agent isn’t picking up your deployment’s flow run at all, then 2 possible issues could be: • you could have started the agent pointing at a different queue than the one you attached to your deployment • your agent has environment variables pointing at a different workspace’s URL / API key • your agent is running a significantly different version of prefect
It may be worth taking a look at
/.prefect/profiles.toml
To see if things look correct there, make sure they are pointing to the right API key.
Remind me, are you using prefect cloud?
And also are you using an infrastructure block for the deployment?
It can be difficult for us to trouble shoot with this since it can be one of many things. Its best to try the simplest of examples to get to the root of the problem.
t

Taylor Babin

09/26/2022, 1:25 PM
I getcha. We are deploying by building a docker image that connects with prefect cloud and deploys the flows and then runs the agent. This image is pushed to the AWS ECR (image repository) and is picked up for the EC2 instance