EC2 Autoscaling group launching more instances than required
0
Hey everyone,
I have setup an ecs cluster with ec2 autoscaling group as capacity provider. When I deploy one service to my cluster. It launches 2 ec2 tasks(or service as there is just one task in service). And then later on kill one of the instance by scaling down. If I launch 2 tasks then it scales to 4 instances and then after that scales down after some time. Now the most problematic thing here is that as its launching instances more than required I am charged for minimum of one hour for each instance it launches. And this stuff is happening continously. And if termination protection is off it's sometimes deleting instances which were in use and so they get deployed again which again triggers to launch 4 instances making this run even in an infinite loop. This would become pretty expensive for me if its not stopped at this point. I am clearly able to see that there are just 2 instances in use but still 2 more are there for no reason. Some information that might be needed -
Capacity provider target capacity is set to 100% ->
And that capacity provider is being used as default capacity provider strategy ->
Would be great if anyone can help me fix this.
Thanks
If that doesn't turn out to be the issue, can you please open a support case around this, referencing this rePost link? Unless Gary has any other ideas, I think this is really going to need an investigation of your resource details that's just not really practical to do over a forum style discussion like this.
I know we’ve tried answering this before. Please could you share the ASG settings pls. Thanks.
Yes had to repost because no one was answering but let me share the settings. https://i.ibb.co/dMDtKJZ/image.png
What is the minimumScalingStepSize when you describe the capacity provider?
If that doesn't turn out to be the issue, can you please open a support case around this, referencing this rePost link? Unless Gary has any other ideas, I think this is really going to need an investigation of your resource details that's just not really practical to do over a forum style discussion like this.
As a quick side note just for your awareness: Most instances aren't hourly billing anymore, ie: https://aws.amazon.com/about-aws/whats-new/2021/06/announcing-per-second-billing-for-ec2-windows-server-and-sql-server-instances/ - so while there does still seem to be over scaling here from your description, its not a full hour billed on each instance
minimumScalingStepSize is 1. Also, I would try to create a support case