Does bridge networking mode in ECS limit number of tasks on container instance
I have an EC2 registered to ECS cluster on which tasks can run. Originally I chose the awsvpc
network mode so every task(container) had it's own ENI(IP). But I ran into limitation at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI
ENI Limit is 3 for m5.large instance type
So I changed the network mode to
bridge
Will using the bridge network limit the tasks to 10 because from the screenshot above the private IP per ENI is limit to 10. I do not know if using bridge
assigns a private IP to the task or not. I checked output of ifconfig
on the EC2 host but it returns a long list of entries(some with private IPs and some without)
Solution 1:
TL/DR: the way bridge networking works is by assigning a port number to the task and expose it to the main ENI of the instance. So you would not hit any ENI/IP limit. If you are still eager to take advantage of the plus of AWS VPC networking mode you may be exploring the Trunk ENI solution that allows you to create virtual ENI to overcome the number of ENIs limit you are pointing out.
The full story: https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/networking-networkmode.html
Also, have you considered Fargate? It hides ALL of this and more.