Copilot-cli: Feature request: new subcommand `svc undeploy`

Created on 22 Sep 2020  Ā·  4Comments  Ā·  Source: aws/copilot-cli

While iterating on an environment, an app, a service, and for various reasons, I sometimes wish to ā€œundeployā€ a service without actually ā€œdeletingā€ it.

For example, if I want to take down a service over the weekend when I won’t be working with it.

Thanks!

Most helpful comment

Another use case for this subcommand: I want to delete an environment, but I can’t because a service is deployed to it:

$ copilot env delete -n avi-test --profile pw-dev --yes                                       <aws:pw-dev>
✘ service 'shared-infra, shared-infra' still exist within the environment avi-test

(I don’t know why the service is listed twice.)

That’s reasonable (although I wish there was a --force option) but now what? Since there’s no command to ā€œundeployā€ a service from an environment, as far as I can tell I need to run copilot svc delete which prompts me with:

$  copilot svc delete  --name shared-infra
  Are you sure you want to delete shared-infra from application plotwatt? [? for help] (y/N) 

Which is definitely not what I want to do; I have this service deployed to other environments. And even if I didn’t, I don’t want to delete it from the application, I just want to undeploy it.

Wait, though — I just ran copilot svc delete help and noticed the --env option, and the _Examples_ section of the help output (which is fantastic BTW) included this:

  Delete the "test" service from just the prod environment.
  `$ copilot svc delete --name test --env prod`

which is great … that seems to be almost exactly what I’m looking for, at least in concrete terms if not in semantics.

So now I just have a few suggestions:

  1. I suggest adding --force option to env delete so all deployed services will be deleted from the environment and then the environment itself will be deleted
  2. I suggest adding the option --app to svc delete and requiring either --app _or_ --env — this will help users learn that they have these different options
  3. I still think a new subcommand svc undeploy would be very helpful in terms of learnability, UX, semantics, etc.

Thanks!

All 4 comments

(This feels somewhat related to #1381 wherein I hadn’t realized that after running svc delete I’d need to run svc init again, to redeploy it, even though I already have a manifest file.)

One thing you can do in the mean time is set the desired count to 0 and deploy it. That'll bring your service down to 0 tasks.

Great suggestion — thanks!

Another use case for this subcommand: I want to delete an environment, but I can’t because a service is deployed to it:

$ copilot env delete -n avi-test --profile pw-dev --yes                                       <aws:pw-dev>
✘ service 'shared-infra, shared-infra' still exist within the environment avi-test

(I don’t know why the service is listed twice.)

That’s reasonable (although I wish there was a --force option) but now what? Since there’s no command to ā€œundeployā€ a service from an environment, as far as I can tell I need to run copilot svc delete which prompts me with:

$  copilot svc delete  --name shared-infra
  Are you sure you want to delete shared-infra from application plotwatt? [? for help] (y/N) 

Which is definitely not what I want to do; I have this service deployed to other environments. And even if I didn’t, I don’t want to delete it from the application, I just want to undeploy it.

Wait, though — I just ran copilot svc delete help and noticed the --env option, and the _Examples_ section of the help output (which is fantastic BTW) included this:

  Delete the "test" service from just the prod environment.
  `$ copilot svc delete --name test --env prod`

which is great … that seems to be almost exactly what I’m looking for, at least in concrete terms if not in semantics.

So now I just have a few suggestions:

  1. I suggest adding --force option to env delete so all deployed services will be deleted from the environment and then the environment itself will be deleted
  2. I suggest adding the option --app to svc delete and requiring either --app _or_ --env — this will help users learn that they have these different options
  3. I still think a new subcommand svc undeploy would be very helpful in terms of learnability, UX, semantics, etc.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamhopaul123 picture iamhopaul123  Ā·  3Comments

kohidave picture kohidave  Ā·  3Comments

BenediktMiller picture BenediktMiller  Ā·  3Comments

noahjahn picture noahjahn  Ā·  3Comments

efe-selcuk picture efe-selcuk  Ā·  3Comments