-
Notifications
You must be signed in to change notification settings - Fork 4k
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
core: Add Stack property for configuring ephemeral Stacks #28281
Comments
@TheRealAmazonKendra as discussed in Las Vegas |
Love it! Thank you for the feature request! related to #28183 |
I love this idea!
I agree, but I have one concern.
In this case, it may be difficult for Aspects( or something) to determine whether the user wants to explicitly set it to SNAPSHOT in the ephemeral stack (DeleteAll) or whether it should be set to DESTROY since the user has not overridden it manually.
Also, in the case of DeleteAll, it would be more convenient for me personally if an option like |
I fully agree. That is why I propose this a a top-level feature and not as an aspect. Each L2/L3 should be able to decide what happens on ephemeral stacks and not the author of the aspect. |
I like the idea, there so many cases where stacks pollute the account and you need to clean up logs, buckets, origin policies and more. It'd be great to set a property on a stack level. Developers won't have to worry about deploying demo stacks or PoCs and will know there won't be any resources left that would increase their bill (i.e. CloudWatch logs). Are there any other solutions right now you can recommend? |
Describe the feature
Currently, the AWS CDK does not provide a built-in way to configure a Stack as ephemeral. This proposal suggests adding a stack property to the Stack class that allows users to mark a Stack as ephemeral. When a Stack is marked as ephemeral, its deletion policy and the one of all resources created within should be set to Delete by default, instead of the default Retain. This will ensure that when an ephemeral Stack is deleted, all associated resources are also deleted automatically.
Use Case
The ability to create ephemeral Stacks would be beneficial for various scenarios, such as test deployments, feature branches, and integration testing. By marking a Stack as ephemeral, users can easily create instances of their CDK stack for temporary purposes without worrying about manual cleanup. This can greatly improve development workflows and enable faster iteration for developers.
Proposed Solution
To make the configuration of ephemeral Stacks future-proof and allow for variants between deleting everything and retaining everything, it is proposed to add an enumeration property to the Stack class in the AWS CDK. This enumeration property can have different values to specify the desired deletion behavior, such as "DeleteAll" for deleting all resources, "RetainAll" for retaining all resources, and potentially additional options for different deletion policies. By using an enumeration, users can easily configure the desired behavior while providing flexibility for future variants if needed.
When a user sets the deletion policy of a resource manually, it overrides the default deletion policy set for the ephemeral Stack. If a resource's deletion policy is manually set to "Retain", for example, it will not be automatically deleted when the ephemeral Stack is deleted. This can lead to unintended consequences, as the resource may continue to exist and potentially accrue costs even after the ephemeral Stack is deleted. It is important for users to be aware of this and exercise caution when manually setting deletion policies for resources within an ephemeral Stack.
Other Information
Warning
To prevent users from accidentally creating unsafe deployments, it is important to add a warning when using the ephemeral Stack property. The warning should remind users that ephemeral Stacks are meant for temporary use and should not be used for long-term or critical deployments. This will help users make informed decisions and avoid unintended consequences.
Please feel free to provide detailed feedback and comments on this proposal. Your input is highly valued and will play a crucial role in shaping the final outcome. I would greatly appreciate any specific suggestions, concerns, or ideas you may have regarding this proposal. Your perspective and expertise are important in ensuring that this proposal meets all necessary requirements and addresses all relevant aspects. Thank you in advance for taking the time to review and provide your input.
I am willing to implement this proposal and/or create a pull request if it is found useful. Depending on the current process I am also open to creating an RFC for this in the correct place.
Acknowledgements
CDK version used
2.x
Environment details (OS name and version, etc.)
all
The text was updated successfully, but these errors were encountered: