aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Feature Request: 'undeploy' CLI option

Open kjhosein opened this issue 8 years ago • 15 comments

Description:

(Am new to SAM, so this hopefully this makes sense!)

How about an undeploy or delete CLI option to delete an already deployed app/stack. Since the deploy is an alias to aws cloudformation deploy, couldn't there be a delete option that is an alias of aws cloudformation delete-stack? Thanks!

Potential Workflow:

cd <app-dir>
sam undeploy OR sam delete

Observed result: Success. Your app (<name of your app>) has been deleted. OR Failed. <error message>

Expected result: Deletes your deployed app.


Note to the maintainers: Although the How to Contribute doc says to add the feature-request label, I did not appear to have the permissions to do so.

kjhosein avatar Nov 16 '18 14:11 kjhosein

Thanks for the feature request! This is a SAM CLI feature request, so transferring to that GH repo.

jlhood avatar Nov 21 '18 18:11 jlhood

i consider the inability to undeploy potentially defective code to be a fairly significant security risk

deploying over it may not be an option (cloudfront has a tendency to get wedged under sls)

is there an eta for this?

StoneCypher avatar Mar 20 '19 00:03 StoneCypher

you can just use the aws cli. not as convenient, but not a critical issue

aws cloudformation delete-stack --stack-name xyz

rl-michaelbrandeis avatar Feb 10 '20 19:02 rl-michaelbrandeis

This would be a good feature to have, I would be up for using the sam cli if cleaning up the resources is easier.

user10x avatar Apr 20 '20 23:04 user10x

Will this include the deletion of the artifact S3 bucket if it was created by sam deploy? That would be my expectation...

lestephane avatar Jun 07 '20 08:06 lestephane

agreed, this is definitely needed

bitsofinfo avatar Jun 21 '20 17:06 bitsofinfo

Adding my 👍 to this. Especially for wooing Serverless Framework users over, this will be important - we're used to sls deploy and sls remove

jthomerson avatar Sep 11 '20 01:09 jthomerson

Thumbs up for this one!

sboettger avatar Sep 11 '20 13:09 sboettger

👍

DogFortune avatar Apr 12 '21 08:04 DogFortune

I agree this should be in the CLI. SAM is really just CloudFormation with a transformation layer on top. So all you really need to do is delete the cloudformation template. But a basic sam delete command would only really need to map to the aws cloudformation delete-stack --stack-name ${sam-app-name} command. It would be nice to do this staying in the SAM CLI instead of switching back and forth between the SAM and normal AWS CLIs

jacurtis avatar Apr 22 '21 01:04 jacurtis

I second what @jacurtis already mentioned. It is definitely more intuitive to do sam delete or sam undeploy or sam destroy than using the aws cli command of aws cloudformation delete-stack --stack-name ${sam-app-name}. There is lot more to type on the command line! We definitely need this feature!

colinbut avatar Jul 21 '21 18:07 colinbut

It appears that such a feature has just been merged into develop a few days ago: #3176

And it does in fact delete S3 buckets created by deployment.

specious avatar Aug 20 '21 22:08 specious

@specious you are right.

https://github.com/aws/aws-sam-cli/releases/tag/v1.29.0 does have a new sam delete command.

Closing this issue as the underlying feature has been released.

sriram-mv avatar Aug 20 '21 22:08 sriram-mv

Release 1.29.0 has the sam delete command.

specious avatar Aug 20 '21 22:08 specious

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Aug 20 '21 22:08 github-actions[bot]