How To Solve Can’t terminate EC2 Instance?

Some of our AWS users got this error “can’t terminate EC2 instance”, there are mainly three causes for this issue.

Causes for Can’t terminate EC2 instance issue?

  • When an instance is in stopping ot pending state.
  • Termination protection is enabled for the instance.
  • Incorrect permissions on the AWS Identity and Access Management (IAM) policy are attached to the role or user that attempting to terminate the instance.

Resolution :

  • When an instance is in stopping or pending state :

If your instance appears to be stuck in the stopping state, first you should stop the instance. You can stop an EC2 instance by choosing the instance and select the stop option from the instance state menu.

After successfully stopped the instance you can terminate the instance.

If the instance is pending for more than 30 minutes after you attempt to launch it. Then run the stop or terminate command from the AWS CLI.

In order to assist with the troubleshooting, enable the –debug option.

  • Termination protection is enabled for the instance :

If termination protection is enabled for an instance you can’t remove that instance.

To disable the termination protection for running or stopped instance, follow the below steps,

Select the instance.

Choose instance settings from Actions and select change termination protection. Then choose yes, disable option there.

  • Incorrect permissions on the AWS Identity and Access Management (IAM) policy are attached to the role or user that attempting to terminate the instance.
  • When we trying to terminate the instance, the IAM policy attached to the user or role must allow ec2:TerminateInstances API.

    From the policy section, you can choose the corresponding policy attached to your EC2 instance. From there you can edit the policy by choosing the permissions tab.

    If you are still facing trouble with terminating your EC2 instance, no need to worry our technical experts will help you to resolve the issue fastly.

    FREE SERVER AUDITING

    Get Auditing Report of Your Server for FREE!!

    Fix this issue for

    $25/Hour

    $6.25/Hour

    Applicable only to the first hour.