copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Feature request: new subcommand `svc undeploy`

Open aviflax opened this issue 5 years ago • 6 comments

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!

aviflax avatar Sep 22 '20 15:09 aviflax

(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.)

aviflax avatar Sep 22 '20 15:09 aviflax

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.

kohidave avatar Sep 22 '20 16:09 kohidave

Great suggestion — thanks!

aviflax avatar Sep 22 '20 18:09 aviflax

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!

aviflax avatar Sep 24 '20 21:09 aviflax

I have to agree and would also like an svc undeploy. It makes sense since creating a service doesn't mean it's deployed. The other way around you cannot undeploy currently, only completely delete.

webjunkie avatar Jan 03 '22 09:01 webjunkie

I am looking for the same feature.

clay-risser avatar Jul 09 '24 12:07 clay-risser