I’m trying to start up an ECS Agent (with the agen...
# ask-community
h
I’m trying to start up an ECS Agent (with the agent runner token) and getting the following error:
ERROR - proteograph-ecs-agent | Failed to infer default networkConfiguration, please explicitly configure using
--run-task-kwargs`` with the most recent prefect version. I’ve run it successfully with other ec2 instances so i’m not sure what’s going on
m
Hello Hugo. Could you please check if you have default VPC in the region you are starting your ECS agent?
If you don't have default VPC, you would need to create it or to provide information about existing VPC in
--run-task-kwargs
or ECSRun
run_task_kwargs
parameter
h
Ah, I am not using the default VPC
how would i specify this using that parameter?
m
You would pass it like this:
Copy code
RUN_CONFIG = ECSRun(labels=["test"], run_task_kwargs={
    "networkConfiguration": {
        "awsvpcConfiguration": {
            "assignPublicIp": "ENABLED",
            "subnets": ["subnet-123"],
            "securityGroups": ["sg-123"],
        }
    }
})
with Flow("test", run_config=RUN_CONFIG) as flow:
    ...
h
sorry, I am not trying to instantiate a ECSRun. I am trying to start the ECS Agent with
prefect agent ecs start
m
You could specify it in run config or agent. If you prefer using agent you could do following:
prefect agent ecs start --run-task-kwargs <path to a yaml file with network configuration>
And your file with network configuration will look like:
Copy code
networkConfiguration:
  awsvpcConfiguration:
    subnets:
      - 'subnet-123'
    securityGroups:
      - 'sg-123'
    assignPublicIp: 'ENABLED'
h
Ah, I see. Thank you!
👍 1