Thread
#prefect-community
    k

    Kha Nguyen

    1 year ago
    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
    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
    [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.
    ciaran

    ciaran

    1 year ago
    @Kha Nguyen 2 secs!
    k

    Kha Nguyen

    1 year ago
    I got it working, I supplied the yaml network config like this
    networkConfiguration:
      awsvpcConfiguration:
        assignPublicIP: ENABLE
        subnets: ["subnet1", "subnet2"]
    ciaran

    ciaran

    1 year ago
    Ahh okay!
    k

    Kha Nguyen

    1 year ago
    Thanks Ciaran 🙂
    ciaran

    ciaran

    1 year ago
    No worries, glad you got it working!