https://prefect.io logo
Title
c

Carl Allen

12/02/2021, 5:27 PM
Hi! I work at a last-mile delivery company built on the gig model. Our data team just made the decision to start using prefect. I’ve been given the task of spinning the infrastructure. I’ve been running through the ECS docs but can’t get the container to actually start. Looking for where to get help with this.
👋 15
d

Dylan

12/02/2021, 5:28 PM
Welcome, @Carl Allen! 👋
#prefect-community is the best channel for asking help questions 😄
g

George Coyne

12/02/2021, 5:29 PM
Welcome Carl! If you'd like some formal support from our CS team feel free to message @Anthony Head directly!
k

Kevin Kho

12/02/2021, 5:29 PM
Hi @Carl Allen, welcome to Prefect!
a

Anna Geller

12/02/2021, 6:00 PM
Hi @Carl Allen, welcome to Prefect! We’ve recently updated the docs for the ECS Agent and the ECSRun, incl. examples in the docstring. There is also this blog post explaining how to set up an ECS service for the agent. But if you have any questions about that, you can reach out and post it in the community channel.
c

Carl Allen

12/02/2021, 6:57 PM
@Anna Geller yeah, I did pretty much all those things (except I did it in terraform) and the container won’t start.
ValueError: Failed to infer default networkConfiguration, please explicitly configure using `--run-task-kwargs``
k

Kevin Kho

12/02/2021, 7:05 PM
How do you spin up the agent? Maybe you can add your network configuration there?
a

Anna Geller

12/02/2021, 7:20 PM
@Carl Allen when you create your ECS service for the agent and you use awsvpc as network mode, then you need to provide network configuration so that AWS knows to which VPC and subnets to deploy this service. You can use the
--network-configuration
option in the command below - this is the configuration that seems to be missing in your Terraform script:
aws ecs create-service \
    --service-name $ECS_SERVICE_NAME\
    --task-definition $ECS_SERVICE_NAME:1 \
    --desired-count 1 \
    --launch-type FARGATE \
    --platform-version LATEST \
    --cluster $ECS_CLUSTER_NAME \
    --network-configuration awsvpcConfiguration="{subnets=[$SUBNET1, $SUBNET2, $SUBNET3],assignPublicIp=ENABLED}" --region $AWS_REGION
c

Carl Allen

12/02/2021, 7:22 PM
nope, that’s all there:
network_configuration {
    subnets          = data.aws_subnet_ids.vpc_subnet_ids.ids
    security_groups  = [aws_security_group.prefect.id]
    assign_public_ip = true
  }
a

Anna Geller

12/02/2021, 7:33 PM
Can you share your entire terraform script for that (without sensitive info) in #prefect-community? perhaps someone from the community knows terraform more to figure it out.