https://prefect.io logo
a

Andreas Tsangarides

10/14/2021, 2:18 PM
Hi all, has anyone deployed an ECSAgent as a Fargate Service with an application load balancer? Trying to figure out: 1. When registering an
ECSAgent
we can use
agent_address=<address:port>
. Should that be the load balancer's DNS ? 2. What is the health-check command to set in the application balancer?
a

Anna Geller

10/14/2021, 2:25 PM
Hi @Andreas Tsangarides, what capacity provider are you using: EC2 or FARGATE?
πŸ‘‹ 1
a

Andreas Tsangarides

10/14/2021, 2:25 PM
Hey Anna! FARGATE
a

Anna Geller

10/14/2021, 2:31 PM
In that case, you don’t need an application load balancer. You would need it only if you use EC2 as your ECS data plane because you would have to place containers for your flows on various EC2 instances depending on metrics like CPU load of each instance. With Fargate, all compute for your Prefect flows gets provisioned on demand, so there is nothing to balance over, if that makes sense πŸ™‚ There is an updated guide on how to set up an ECS service for the Prefect agent: https://towardsdatascience.com/how-to-cut-your-aws-ecs-costs-with-fargate-spot-and-prefect-1a1ba5d2e2df
πŸ‘€ 1
a

Andreas Tsangarides

10/14/2021, 2:42 PM
Can I not load balance the ECSAgent Fargate service itself to ensure at least one instance is running? That way I can define a security group for the long running instance, too?
a

Anna Geller (old account)

10/14/2021, 4:52 PM
@Andreas Tsangarides Prefect agent is a lightweight process, so one container is enough, and running your container as ECS service will ensure that even if the agent container dies for some reason, ECS service will restart it.
βœ… 1
a

Andreas Tsangarides

10/14/2021, 5:31 PM
ok good shout! Thanks @Anna Geller
πŸ‘ 1
agent-service.tf.txt
All works! thanks @Anna Geller fyi, the terraform snippet for running the ECSAgent in
private
subnets (i am using a NAT gateway, so do not need to enable the public ip)
πŸ‘ 1
4 Views