Solution for Client.InsufficientFreeAddressesInSubnet - Task Placement for EventBridge Scheduled Task on Fargate

0

I have a VPC with 3 private subnets each with 20 total IP addresses. We have an ALB and an NLB and a Fargate ECS Cluster with ~14 micro-services that run in our private subnets. We are running into a situation where one of our 3 private subnets is down to 0 free IP addresses, the others have about 5 free each. We also have 3 EventBridge Scheduled tasks that I run staggered, midnight, 1 AM and 2 AM, to avoid IP address competition. For some reason the tasks are being placed in the subnet with 0 free IP addresses and we get the error Client.InsufficientFreeAddressesInSubnet. Documentation states that Task placement strategies and constraints aren't supported for tasks using the Fargate launch type. Apart from creating a new VPC with larger Private subnets, is there a temporary solution that I can implement? I'm also getting this error when our other Fargate tasks try to auto-scale up. Long term we are going to instantiate a new VPC but our Cloud Team has to do that, so while we wait I was exploring other options.

1 Antwort
1

Hello.

As far as I know, I don't think you can use ECS alone to determine the availability of IP addresses in a subnet and launch a task.
The easiest way is to extend the CIDR by setting up a secondary CIDR in your VPC.
https://repost.aws/knowledge-center/vpc-ip-address-range

I think it would be possible to change the subnet to start ECS based on the availability of IP addresses in the subnet if you create a mechanism to start ECS independently using Lambda etc. instead of using Task Scheduler.
However, we do not recommend this because it will start container tasks using a mechanism that is not managed by AWS, so if a problem occurs, it is likely to be complicated to resolve the cause.

profile picture
EXPERTE
beantwortet vor 4 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen