How to enable termination protection in aws ec2 instance?

You can enable termination protection for your ec2 instance to protect it from accidental deletion. By default, when you launch a new ec2 instance, termination protection is disabled and a user who has proper access can accidentally terminate your ec2 instance. If you enable termination protection, you cannot terminate your ec2 instance till you disable the termination protection first.

Step 1: Log in to your AWS management console


Step 2: Navigate to the EC2 service and from the “Instances” select your EC2 instance.


Step 3: Click “Actions” > “Instance settings” > “Change termination protection”


Step 4: Select “Enable” and click “Save”.

Now if you try to terminate your EC2 instance, you will get an error message “Failed to terminate an instance: The instance ‘i-0e0208df19904e22c’ may not be terminated. Modify its ‘disableApiTermination’ instance attribute and try again.”

Leave a Reply