[SOLVED] How to enable EC2 Instance termination protection in AWS CDK?


This Content is from Stack Overflow. Question asked by tom10271


I cannot find anything related to it. I guess I need to use L1 construct?


Yes, you will have to use the L1 construct: CfnInstance.

This construct has the disableApiTermination prop which can be set to true to enable termination protection.

Type: boolean | IResolvable (optional)

If you set this parameter to true , you can’t terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can.

Default: false

This Question was asked in StackOverflow by tom10271 and Answered by Ermiya Eskandary It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?

Exit mobile version