Charles Lariviere

    Charles Lariviere

    1 year ago
    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?
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    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!
    Charles Lariviere

    Charles Lariviere

    1 year ago
    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?
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    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.
    Charles Lariviere

    Charles Lariviere

    1 year ago
    Thanks @Kyle Moon-Wright 🙏 While deploying the ECS agent, it errors out with:
    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?
    Sagun Garg

    Sagun Garg

    1 year ago
    @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()
    Charles Lariviere

    Charles Lariviere

    1 year ago
    @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.
    Sagun Garg

    Sagun Garg

    1 year ago
    @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