Why can't I terminate my Amazon EC2 instance?
Last updated: 2022-06-27
Why can't I terminate my Amazon Elastic Compute Cloud (Amazon EC2) instance?
Your EC2 instance might not terminate for the following reasons:
- The instance is in the stopping or pending state.
- Termination protection is enabled on the instance.
- There are incorrect permissions on the AWS Identity and Access Management (IAM) policy attached to the role or user attempting to terminate the instance.
The instance is in the stopping or pending state
If the instance appears to be "stuck" in the stopping state, see Troubleshoot stopping your instance. After you have successfully stopped the instance, you can then terminate it.
If the instance remains in the pending state for more than 30 minutes after you attempt to launch it, then use the AWS Command Line Interface (AWS CLI) to stop the instance. In the AWS CLI, run the stop command with a --force option or run the terminate command
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.
Termination protection is enabled on the instance
If termination protection is enabled, you can't terminate the instance. For information on disabling termination protection on your instance, see Enable termination protection and follow the instructions in To disable termination protection for a running or stopped instance.
There are incorrect permissions on the IAM policy attached to the role or user attempting to terminate the instance.
The IAM policy attached to the role or user attempting to terminate the instance must allow the ec2:TerminateInstances API. For information on editing IAM policies, see Editing IAM policies.