How to handle situations when you can't delete unwanted EC2 instances

How to handle situations when you can't delete unwanted EC2 instances

2026.01.26

This page has been translated by machine translation. View original

Issue I Was Facing

When trying to terminate (delete) an EC2 instance that was no longer needed,
I received the error message: The instance 'i-xxxxxxxxxxxxxxxxx' may not be terminated. Modify its 'disableApiTermination' instance attribute and try again.

Looking at the error message, it asks to change the disableApiTermination attribute.
Screenshot 2026-01-06 142744

How to Address This?

disableApiTermination is the termination protection feature for EC2 instances. When enabled, it blocks termination operations from API/CLI/console.
When checking the details of the EC2 instance, I confirmed that termination protection was enabled.
Screenshot 2026-01-06 162850

Here's how to disable termination protection:

  1. Access the EC2 instance dashboard
  2. Select the instance where you want to change termination protection
  3. Click "Actions" → "Instance Settings" → "Change Termination Protection"
  4. Uncheck the enable box, and click "Save"

Screenshot 2026-01-06 163121
Screenshot 2026-01-06 163205
Screenshot 2026-01-06 163237

On the instance details screen, I could confirm that termination protection was disabled.
Screenshot 2026-01-06 163252

Now that termination protection is disabled, I tried terminating the instance again.
Screenshot 2026-01-06 163349

The termination started successfully and the instance is now terminated!
Screenshot 2026-01-06 163446

Reference Material

Change Termination Protection for an Instance - Amazon Elastic Compute Cloud

Share this article

FacebookHatena blogX

Related articles