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개 답변
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
전문가
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠