'AWS fargate ecs service shutting down after 10~15 mins

we have 2 environment acpt and acpt-contigiency

in acpt-contigiency env We have ECS fargate services set with with Desired capacity=0 Min capacity=0 and max capacity=0 as we will use only if acpt goes down

so when we switched over from acpt to acpt-contigiency env and just updated the desired count =2 , min capacity=0 and max capacity=0 we observed that the ecs services went down after 10~15 mins

Nothing in aws cloudwatch log , in ecs service event it shows that it is bringing down ecs instance but did not mention reason

in ecs service -Tasks -> stopped -> it shows the reason as stopped due to scaling policy

Any idea what autoscale policy it might be bringing down the instance ? using target tracking with ECSServiceAverageCPUUtilization at 70



Solution 1:[1]

What we found out was alarm got triggered for CPUUtilization < 63 for 15 datapoints within 15 minutes which in turn reset the desired count to 0 ( may be it tried to reset to previous saved value or tried to match min/max capacity) and shutdown the instances

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sagar Shah