I am running ECS tasks (using awsvpc networking) on a "t3.small" EC2 server instance but am encountering RESOURCE:ENI
errors when attempting to run more than 2 tasks, described here as:
For RESOURCE:ENI errors, your cluster does not have any available elastic network interface attachment points, which are required for tasks that use the awsvpc network mode. Amazon EC2 instances have a limit to the number of network interfaces that can be attached to them, and the primary network interface counts as one. For more information about how many network interfaces are supported per instance type, see IP Addresses Per Network Interface Per Instance Type in the Amazon EC2 User Guide for Linux Instances.
t3.small instance types are documented as supporting 4 private IPv4 addresses per interface:
My EC2 instance has a public IP address (while my ECS tasks have private IP addresses) which I think explains why I can only run 2 tasks, not 3. (Amazon states that the primary network interface counts as one.)
However, "Private Ipv4 addresses per interface" would seem to indicate that by assigning another network interface to my EC2 instance I could allow another 4 ECS tasks to run before hitting the RESOURCE:ENI
error - but when I do this, I can only run 1 task! The additional interface apparently consumes one of the elastic network interface attachment points.
This doesn't seem right. I'm relatively new to docker and ECS, but a limit of 2 or 3 tasks/containers on a t3.small EC2 instance seems low. I thought it was good practice to use lots of small containers rather than a few big ones.
Are my only options to use larger instances or switch to bridge networking (even though Amazon recommend awsvpc), or am I missing something?
Updated to add: even when associating my EC2 server with private subnets, and assigning only its single default network interface, I am still apparently only able to run 2 tasks before hitting RESOURCE:ENI.
question from:https://stackoverflow.com/questions/66066448/amazon-ecs-on-ec2-server-instance-hitting-resourceeni-error