Hello, I have a work pool with an AWS ECS infrast...
# ask-community
d
Hello, I have a work pool with an AWS ECS infrastructure type attached to a deployment. Whenever I run the deployment the flow enters a pending state while the ecs task is provisioning, then immediately crashes. I've inspected the ecs task logs in AWS and I can see that the container fails with this exception
Copy code
httpx.ConnectError: [Errno -2] Name or service not known
I do have a basic task definition defined in AWS, which simply points to a prefect docker image. The service doesn't expose any docker ports so there are no port mappings. I am not sure why the service keeps failing. I do believe it has something to do with prefect inside of the ecs task not being able to connect to the prefect server that is deploying the worker, but I am not sure. Any advice would be helpful.
j
Hey there, sorry you're running into a problem. Theres the following parts here: 1. your prefect server (the API) 2. your prefect worker (a long lived process that polls the api and deploys runs to ECS) 3. your ECS task, spun up by the prefect worker that will execute your flow if your run is getting to
PENDING
and then crashing it sounds like your theory is correct. The worker is able to pickup the flow run, deploy the flow run to ECS, but then inside the ECS task it cannot connect back to your prefect server. The worker should be setting the env var
PREFECT_API_URL
on your ECS task. Is that a public URL? If not I would look at security settings or the VPC of the server/task and to make sure that address is accessible
d
Thank you for responding. No the server is not public and is within a vpc. So I will check that I did add the VPC ID, to the configuration in the prefect server but it seems as if it's not being utilized.
I'll double check the PREFECT_API_URL environment variable.
The PREFECT_API_URL is not a public url
j
The worker should be adding that env var automatically for you, but it's worth making sure
if that value is correct, it does seem like its networking/security settings on the ECS task itself
d
Got it ok, i'll check the networking/security settings