I opened a free tier instance for some practice.
I tried to terminate it, as I've done many times successfully.
But upon selecting Terminate instance
from the dropdown;
I got the following error:
Failed to terminate the instance <instance id>
The instance '<instance id>' may not be terminated. Modify its 'disableApiTermination' instance attribute and try again.
Where can I find the disableApiTermination
attribute?
According to the documentation
To disable termination protection for a running or stopped instance
Select the instance, and choose Actions, Instance Settings, Change Termination Protection.
Choose Yes, Disable.
Using AWS CLI you can use this command
aws ec2 modify-instance-attribute --instance-id <instance-id> --no-disable-api-termination