Hi all. I am trying to setup ECS agent to run flow...
# ask-community
k
Hi all. I am trying to setup ECS agent to run flows in Fargate. Assuming that I have an ECS Fargate cluster ready, here is how I start my agent
Copy code
from prefect.agent.ecs import ECSAgent

agent = ECSAgent(
    name='Test Agent',
    region_name='eu-west-1',
    cluster='my-test-cluster',
    launch_type='FARGATE',
    run_task_kwargs_path='./config.yaml'
)
agent.start()
This then failed with the following message
Copy code
[2021-05-14 12:46:54,069] ERROR - Test Agent | Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs`
Traceback (most recent call last):
  File "/Users/kha/Desktop/foo/agent.py", line 3, in <module>
    agent = ECSAgent(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/zoined/lib/python3.9/site-packages/prefect/agent/ecs/agent.py", line 234, in __init__
    ] = self.infer_network_configuration()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/zoined/lib/python3.9/site-packages/prefect/agent/ecs/agent.py", line 274, in infer_network_configuration
    raise ValueError(msg)
ValueError: Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs`
I am not sure what networkConfig I should setup. I also cannot find any guide for ECS agent online.
c
@Kha Nguyen 2 secs!
k
I got it working, I supplied the yaml network config like this
Copy code
networkConfiguration:
  awsvpcConfiguration:
    assignPublicIP: ENABLE
    subnets: ["subnet1", "subnet2"]
👍 1
c
Ahh okay!
k
Thanks Ciaran 🙂
c
No worries, glad you got it working!