Skip to content

NetworkBindings missing from describe_tasks. Bug??

0

Hey All

I'm trying to extract 'containerPort' from 'networkBindings' returned in the describe_tasks api call. I noticed that networkBindings are missing when the task launchType is fargate, even though containerPort is explicitly defined in taskdefintion. The response looks like this : 'networkBindings': []

But if the launchType is ec2, networkBindings are correctly returned : 'networkBindings': [{'bindIP': '0.0.0.0', 'containerPort': 80, 'hostPort': 80, 'protocol': 'tcp'}]

Is this a known bug or am I doing something wrong?

Cheers V

asked 3 years ago275 views

1 Answer
0

When using AWS Fargate as the launch type for ECS tasks, the networkBindings field in the describe_tasks API response will be empty ([]). This is because AWS Fargate abstracts away the management of network bindings and does not expose host ports directly to containers. In contrast, when using EC2 as the launch type, networkBindings will contain details like containerPort, hostPort, and others, reflecting the ability to bind ports directly to the host.

This difference in behavior is intentional and reflects how networking is managed differently between Fargate (serverless compute) and EC2 (virtual machine) launch types in AWS ECS.

EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.