https://prefect.io logo
c

Charles Lariviere

01/04/2021, 6:16 PM
Hey all 👋 Has everyone here written or found a guide on how to actually deploy Prefect on AWS in a production setting? It’s great and all to be able to run a flow and deploy agents locally (or on ECS by running
prefect agent ecs start
); but for Prefect to be able to run flows on a schedule, it requires an agent to be always running (since Prefect Cloud doesn’t spin up agents). How does one actually do this without spending days experimenting?
🙌 1
👀 1
k

Kyle Moon-Wright

01/04/2021, 6:23 PM
Hey @Charles Lariviere, Check out this article on deploying Prefect pipelines on EKS, I think this will be helpful to understanding what productionized Prefect could look like. The agents are an integral part of the Hybrid Execution Model to keep execution in your infrastructure, so happy to answer any specific questions on them!
c

Charles Lariviere

01/04/2021, 6:29 PM
Awesome, thanks for sharing this article @Kyle Moon-Wright — I was actually reading it this morning. As I understand it, the command that actually deploys the agent in-cluster is `prefect agent kubernetes install`; as opposed to
prefect agent kubernetes start
which spins up an agent tied to the local terminal session. There does not appear to be an equivalent command for ECS in the CLI. Is there a straightforward way we could deploy an ever-running agent in ECS?
k

Kyle Moon-Wright

01/04/2021, 7:04 PM
Hmm, no article on deploying to ECS quite yet and noted on the lack of an install CLI command with the ECS Agent, as it works a bit differently. Typically, I see users using
prefect agent ecs start
on their ECS instances to pick up work from their Cloud tenant and finding success there - as long as you provide a RUNNER token to the agent, it can be left in that instance to pick up work. It is a relatively lightweight process that can be left polling, while the actual work will delegated as a FlowRun for compute as a separate process.
c

Charles Lariviere

01/05/2021, 5:26 PM
Thanks @Kyle Moon-Wright 🙏 While deploying the ECS agent, it errors out with:
Copy code
ERROR - agent | Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs`
This agent is deployed in ECS through a task that pulls the
<http://docker.io/prefecthq/prefect:latest|docker.io/prefecthq/prefect:latest>
image, and executes
prefect agent ecs start -t <TOKEN> --cluster prefect
. It’s unclear to me which network configuration the agent expects?
👀 1
s

Sagun Garg

01/21/2021, 7:48 AM
@Charles Lariviere @Kyle Moon-Wright Apologies in jumping in between your thread, please can you suggest by any chance if you managed to solve this issue, I am also getting this error since last 4 days for ECSRun()
c

Charles Lariviere

01/21/2021, 2:35 PM
@Sagun Garg I didn’t manage to find a solution for the ECS agent, and instead opted for the Kubernetes agent deployed through EKS — it was much easier to deploy and better documented. Apart from the $0.10/hour fee for the EKS cluster, pricing will be essentially the same as ECS if you were to opt in to Fargate in both.
s

Sagun Garg

01/22/2021, 9:50 AM
@Charles Lariviere After having some issues with EKS I was looking towards additional agent with EC2/Faragte on ECS just to have backup agents and leverage Universal Run incase EKS takes too much time to boostrap [There is a load time of 10-15 secs on EKS, plus I need to figure out in deployment.yaml a way to provision enough resources on EKS as some flows are timing out because of Zombie heartbeats problem, specially in flows where I am downloading 100mb CSVs from S3] Appreciate you replying me, I am trying to see what are my options, I have made some inroads in ECS Runs using fargate, I am able to create an agent but it gets killed after it starts because of an identified unpickling error Ref: https://prefect-community.slack.com/archives/CL09KU1K7/p1611228554021600?thread_ts=1610628910.018100&amp;cid=CL09KU1K7