Why is my EC2 instance stuck in the stopping state?

4 minute read
0

I tried to stop my Amazon Elastic Compute Cloud (Amazon EC2) instance and now it is stuck in the stopping state.

Short description

Instances might appear to be "stuck" in the stopping state in the following scenarios:

  • There are issues with the underlying hardware hosting the instance or the system status check failed.
  • The instance status checks failed.
  • There are out of memory (OOM) errors on the instance.
  • You're trying to hibernate the instance.

Resolution

(Optional) Check the instance state

To check the most recent state of your instance, choose the refresh icon in the Amazon EC2 console. Or, run the describe-instances command in the AWS Command Line Interface (AWS CLI).

Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent version of the AWS CLI.

In the following example command, replace i-0123ab456c789d01e with the ID of the instance that you're trying to stop:

aws ec2 describe-instances --instance-ids i-0123ab456c789d01e --output json

Check the State Code and Name in the JSON response:

"State": { 
 "Code": 64, 
 "Name": "stopping"
 },

If your instance becomes stuck in the stopping state, then do the following to force stop the instance:

Issues with the underlying hardware hosting the instance or system status check failure

System status check failures indicate that there is an issue with the hardware hosting your EC2 instance. The instance must be migrated to a new, healthy host by stopping and starting the instance.

Wait for Amazon EC2 to perform the stop and start of your instance. Or, you can force stop the instance. For instructions on force stopping, see the following section Force stop the instance.

For more information, see, My EC2 Linux instance failed its system status check. How do I troubleshoot this?

Instance status check failure

If the instance status check failed, then the instance might appear to be stuck in the stopping state due to running shutdown scripts. Or, instances stopped using the StopInstances API to troubleshoot with a rescue instance might appear to be stuck. This is because the StopInstances operation might take a while because the instance is unreachable.

In these scenarios, the instance does stop eventually. Or, you can force stop the instance. For instructions on force stopping, see the following section Force stop the instance.

OOM errors on the instance

Check the instance's console logs for OOM errors. For more information, see Why is my EC2 Linux instance becoming unresponsive due to over-utilization of resources?

Instances in the hibernation process

If the instance appears to be stuck in the stopping state during hibernation, then you can force stop the instance. For instructions on force stopping, see the following section Force stop the instance.

For more information, see Troubleshoot hibernation.

Force stop the instance

If your instance becomes stuck in the stopping state, then you can force stop the instance:

Use the Amazon EC2 console

  1. Open the Amazon EC2 console.
  2. Select Instances, and then select the stuck instance.
  3. Select Instance state, Force stop instance, Stop. Note that Force stop instance is only available in the console if your instance is in the stopping state. If your instance is in another state (except shutting down and terminated), then you can use the AWS CLI to force stop your instance.

Use the AWS CLI

Use the stop-instances command and the --force option as shown in the following example:

aws ec2 stop-instances --instance-ids i-0123ab456c789d01e --force

Additional resources

If the preceding resolution steps don't resolve the issue, then post a request for help on AWS re:Post. To expedite a resolution, include the instance ID, and describe the steps that you've already taken.

For more information,, see Troubleshoot stopping your instance.

AWS OFFICIAL
AWS OFFICIALUpdated 9 months ago