Feature Request: 'undeploy' CLI option
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.
Thanks for the feature request! This is a SAM CLI feature request, so transferring to that GH repo.
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?
you can just use the aws cli. not as convenient, but not a critical issue
aws cloudformation delete-stack --stack-name xyz
This would be a good feature to have, I would be up for using the sam cli if cleaning up the resources is easier.
Will this include the deletion of the artifact S3 bucket if it was created by sam deploy?
That would be my expectation...
agreed, this is definitely needed
Adding my 👍 to this. Especially for wooing Serverless Framework users over, this will be important - we're used to sls deploy and sls remove
Thumbs up for this one!
👍
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
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!
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 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.
Release 1.29.0 has the sam delete command.
⚠️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.