Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ECS tasks desired count not working

I have three EC2 instances, with a classic load balancer. Ideally I should have two tasks running in two instances. So when creating the service I made the desired count of the tasks to 2.

My problem arises when I try to run new version of the task definition. I update the service to run the new task definition. So it should theoretically run two updated tasks replacing the old ones, since i have three ec2 running.

What happens actually is only one updated task is running together with the old tasks. So altogether 3 tasks running even though the desired count is set to 2, as you are able to see in the given image.

enter image description here

Does anyone know a solution for this ?

like image 230
Lahiru Liyanapathirana Avatar asked Jan 14 '17 15:01

Lahiru Liyanapathirana


People also ask

What is desired count in ECS?

The desired count is the count of the task by your service at that moment. That does not essentially means that your all that's will be in running state.

Can ECS Task return value?

Data Out. ECS or Fargate tasks are unable to return output values to the calling Step Functions.

Does ECS support auto scaling?

Automatic scaling is the ability to increase or decrease the desired count of tasks in your Amazon ECS service automatically. Amazon ECS leverages the Application Auto Scaling service to provide this functionality. For more information, see the Application Auto Scaling User Guide.


Video Answer


1 Answers

When using a classic load balancer, you can only map static ports on the ec2 instance.

Your deployment settings are: min-health: 100% max-healthy: 200%

The new version of the service would require two more hosts available with the free tcp port you requested. Since you only have 3 servers in the cluster, this condition will not be satisfied. You can either add more servers to your cluster, or use the Application Load Balancer (ALB) which will integrate with docker dynamic port mapping.

Update regarding security groups: To manage security groups, you can tag a security group with another. For example, tag your ALB with 'app-gateway-alb' which allows specific ports from outside your network, then on the container have a security group which allows ANY TCP from 'app-gateway-alb' this is achieved by putting the security group ID in the text box where you would generally put the CIDR rule.

like image 87
JD Williams Avatar answered Oct 19 '22 23:10

JD Williams