-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cdk bootstrap - no destroy option #986
Comments
The standard practice would be to run |
I think there are use cases where people want to destroy the bootstrap stack, let alone cleaning the bucket up. Technically those buckets can fill up quite easily and incur unwanted costs for users. I think we should support something like: $ cdk bootstrap --destroy And: $ cdk boostrap --clean |
As far as I know, if a template size is bigger than 50KB, |
Bug Fixes - java: handle null-able collections correctly (#986) (e88e5e2), closes #4316 - jsii: unable to depend on modules with private declarations (#995) (08c4294), closes #994 - kernel: cannot pass decorated structs to kernel as "any" (#997) (2bd3183), closes #5066 Features - jsii-config: introducing jsii-config (#981) (2bbf576), closes #904 - rosetta: extract and compile samples into "tablets" (#925) (eec44e1)
* feat: upgrade to jsii 0.20.7 Bug Fixes - java: handle null-able collections correctly (#986) (e88e5e2), closes #4316 - jsii: unable to depend on modules with private declarations (#995) (08c4294), closes #994 - kernel: cannot pass decorated structs to kernel as "any" (#997) (2bd3183), closes #5066 Features - jsii-config: introducing jsii-config (#981) (2bbf576), closes #904 - rosetta: extract and compile samples into "tablets" (#925) (eec44e1) * fix broken code * type a couple of more arrays * fix another untyped array * fix a couple more issues * another untyped array * more
Is it enough to just destroy the CloudFormation stack |
This is also useful, for anyone who landed here: #1812 (comment) |
IIRC, If the bucket is non-empty, then the CloudFormation delete step will skip it. Only empty buckets can be deleted by destroying the stack. |
Is it planned to add a delete command for this or are we just relying on the user deleting the CDKToolkit stack? Just out of curiosity |
Just ran into this issue. i had a frontend that failed to deploy. part of that frontend deployment was a bunch of s3 buckets. i accidentally deleted the cdk staging bucket and got stuck not being able to do anything. would make total sense to be able to delete the bootstrap. |
Thanks to this thread i was able to go into CloudFormation and delete the CDKToolkit template (otherwise I would have no idea) and then re-run cdk bootstrap after that. However, I agree it should be an option in the cli. |
It is important to be able to un-bootstrap for the sakes of testing everything from 0 to 100%. To clean up fast now: aws cloudformation delete-stack --stack-name CDKToolkit
aws s3 ls | grep cdktoolkit # copy the name
aws s3 rb --force s3://cdktoolkit-stagingbucket-abcdef # replace the name here Edit: added |
I have been trying out cdk and I am really bad at naming. I named everything Now I would like to destory bootstrap s3 bucket and there is no option. Other than manual nuclear force delete.
Also within same account and within same region I plan to launch multiple project and I don't want to mix all of them into single cdk project. I want each project to have their own independant cdk project. |
PLEASE HELPI manually deleted cdktoolkit-stagingbucket-xxx and now I tried to create another project and deploy. Its successfully bootstrapping but it fails to deploy with following error.
And here is when I
Again when I deploy it fails with error above SolvedJust delete |
Thank you for this snippet! 👍 |
Thanks @0xVesion for the correction. I edited my original comment to add the |
I couldn't successfully delete the CDKToolkit stack until the staging bucket was emptied. Building on earlier comments from @moltar and @0xVesion, I use: cdk destroy
aws s3 rm --recursive s3://$(aws s3 ls | grep cdktoolkit | cut -d' ' -f3) # empty the cdktoolkit staging bucket
aws cloudformation delete-stack --stack-name CDKToolkit |
Would be nice to see some action on this item :) |
But what if CDK bootstrap deploys bucket and ECR repo? How will pay for content in s3 bucket even when it is not used? Who will pay for ECR repository? What if one of my cloud applications is needed to remove? I will run cdk destroy and still pay for all file/image in bucket and ECR repo? What if some application pushed sensitive content via assets - I have to manually process all bootstrap bucket content to find and clean assets for one application - this is a lot of work. Also what about the security? Some with access to CdkToolKit stack can break everything in my region and account? In my opinion, it is much better to have multiple bootstrapped stacks per several (but not all!) cloud applications. |
Also, look for your competitors in serverless framework - they create a bootstrap bucket per deployment or allow you to set this bucket and create it in a separate stack. They do not force users to bootstrap once. |
Waiting for this, the concept to recreate 0% to 100% all cloud resources is a must on an automated environment 😄 , I know that the first resources like some initial IAM policies etc could not be automated at all. But all of resources that you can create with the initial IAM permissions should be deleted and created on easy way. Any due date for that? Thanks in advance! |
Related #19172 |
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue. |
Removing the bootstrap bucket could result in failures in future deployments, so we need to proceed with caution. |
|
Sure, removing anything in the CDK toolkit stack could result in failures in future deployments - but people want to have that ability. The linked RFC does not cover destroying the |
Steps
run 'cdk bootstrap' creates S3 Bootstrap Bucket via cloudformation template.
run 'cdk bootstrap destroy' or 'cdk destroy'
Expected:
Informs you you need to remove the bootstrap bucket manually and then delete the cloudformation. (perhaps also the name and region with links)
Or : Removes the cloudformation S3 bucket , which could get below error.
-----The bucket you tried to delete is not empty (Service: Amazon S3; Status Code: 409; Error Code: BucketNotEmpty; Request ID:
Or: Option to delete the s3 bucket if empty
Current: S3 bucket not removed or no option to run.
Workaround:
Open console our use CLI to remove the s3 bucket created and the cloudformatin template
Note: Is it a standard use case to always run cdk bootstrap before initial deploy.
The text was updated successfully, but these errors were encountered: