aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.48k stars 401 forks source link

Feature request: new subcommand `svc undeploy` #1410

Open aviflax opened 4 years ago

aviflax commented 4 years ago

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 commented 4 years ago

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

kohidave commented 4 years ago

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.

aviflax commented 4 years ago

Great suggestion — thanks!

aviflax commented 3 years ago

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!

webjunkie commented 2 years ago

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.

clay-risser commented 2 months ago

I am looking for the same feature.