amazon-ecs-cli icon indicating copy to clipboard operation
amazon-ecs-cli copied to clipboard

I would like to compose service up and specify the desiredCount

Open miked63017 opened this issue 6 years ago • 10 comments

Summary

I would like to compose service up and specify the desiredCount

Description

  • I have read through the docs and I can't seem to find any way to specify the desiredCount for a task
  • A good example would be if I had a frontend service that I would like to have multiple containers running under a service
  • Perhaps I missed this in the docs, but I cannot find a documented way of doing this with ecs-cli

miked63017 avatar May 28 '19 18:05 miked63017

Hi @miked63017, does ecs-cli compose service scale solve your problem?

$ ecs-cli compose service scale --help        

NAME:
   ecs-cli compose service scale - ecs-cli compose service scale [count] - scales the desired count of the service to the specified count

USAGE:
   ecs-cli compose service scale [command options] [arguments...]

OPTIONS:
   --deployment-max-percent value          [Optional] Specifies the upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment.
   --deployment-min-healthy-percent value  [Optional] Specifies the lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment.
   --region value, -r value                [Optional] Specifies the AWS region to use. Defaults to the region configured using the configure command
   --cluster-config value                  [Optional] Specifies the name of the ECS cluster configuration to use. Defaults to the default cluster configuration.
   --ecs-profile value                     [Optional] Specifies the name of the ECS profile configuration to use. Defaults to the default profile configuration. [$ECS_PROFILE]
   --aws-profile value                     [Optional] Use the AWS credentials from an existing named profile in ~/.aws/credentials. [$AWS_PROFILE]
   --cluster value, -c value               [Optional] Specifies the ECS cluster name to use. Defaults to the cluster configured using the configure command
   --timeout value                         Specifies the timeout value in minutes (decimals supported) to wait for the running task count to change. If the running task count has not changed for the specified period of time, then the CLI times out and returns an error. Setting the timeout to 0 will cause the command to return without checking for success. (default: 5)

efekarakus avatar May 28 '19 18:05 efekarakus

@efekarakus thanks for the quick reply, and it does solve my problem kind of. Basically, it just feels like you should be able to set the desiredCount on the compose service up command, rather than having to bring up one then run another command to scale up to 2(or more). I am not sure if there is a way to do it in the service up command, if not scale fits just fine and it probably would not be worth a feature request, but I figured it would at least be worth asking if it was possible.

miked63017 avatar May 28 '19 19:05 miked63017

Ah gotcha, that makes sense. After digging through the code, I believe you're right we don't provide a way at the moment to set a desired count part of compose service up.

I'll bring this up to our team, sounds like adding a --count flag to the sub-command would be a nice to have :)

efekarakus avatar May 28 '19 20:05 efekarakus

For context, we had an old PR that added that was discarded -- might be a good starting point: https://github.com/aws/amazon-ecs-cli/pull/656 and https://github.com/aws/amazon-ecs-cli/pull/756/

SoManyHs avatar May 28 '19 20:05 SoManyHs

Any idea when this will be fixed, i have two ECS instances but by default when service comes up one task comes up and fails. Once i scale it manually to 2 tasks. This works fine.

sudhir05 avatar Jul 27 '20 06:07 sudhir05

I'm also having some frustrating days with this. I'm new to ECS but I like the docker commands. Is there any time frame when you think this will be fixed/added?

chelto avatar Jul 21 '21 09:07 chelto

Same here, waiting for this flag to be added

Eliasi1 avatar Jul 28 '21 11:07 Eliasi1

is it possible to pass desiredCount in ecs-params.yml and have this working? I tried but it does not change anything nor it gives any error.

apjneeraj avatar Aug 04 '21 05:08 apjneeraj

Very old, very annoying deficiency. ECS operations are SLOW. The difference between invoking ecs-cli once and invoking it twice in order to accomplish something can add up to an hour within a day.

rulatir avatar Nov 15 '21 11:11 rulatir

Any update on this?

ericmerlen avatar Nov 01 '22 15:11 ericmerlen