How to enable Termination Protection on an EC2 Instance

Login to AWS Management Console and navigate to EC2 dashboard. Search for the instance that you would like to modify and right click on the instance. Select ‘Change Termination Protection’ under ‘Instance Settings’.

On the ‘Enable Termination Protection’ window, confirm by choosing ‘Yes, Enable’.

To enable termination protection from AWS CLI, run the following command where INSTANCEID is the instance id of the EC2 Instance.

aws ec2 modify-instance-attribute --disable-api-termination --instance-id INSTANCEID

Below is the command to enable termination protection using AWS CLI for multiple instances.

aws ec2 modify-instance-attribute --disable-api-termination --instance-id INSTANCEID1 INSTANCEID2 INSTANCEID3
See also  How to view all the policies attached to an IAM group