Skip to content

Why is my EC2 instance stuck in the stopping state?

4 minute read
2

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 be stuck in the stopping state in one of the following scenarios:

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

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

(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 CLI.

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

Note: Replace i-0123ab456c789d01e with the ID of the instance that you want to stop.

Example output:

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

Check the State Code and Name in the JSON response.

Issues with the underlying hardware that hosts the instance, or system status check failure

System status check failures are a result of issues with the hardware that hosts your Amazon EC2 instance. To resolve this issue, migrate your instance to a new, healthy host. Before you migrate your instance, wait for Amazon EC2 to stop and start your instance. Or, you can force stop the instance. For instructions on how to force stop the instance, see the Force stop the instance section of this article.

For more information, see Why did my EC2 Linux instance fail a system status check?

Instance status check failure

If the instance status check failed, then the instance might be stuck in the stopping state because it's running shutdown scripts. Or, the instance that no longer uses the StopInstances API to troubleshoot with a rescue instance is stuck in the stopping state. You can use the StopInstances operation to stop an instance, but the 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 how to force stop the instance, see the Force stop the instance section of this article.

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 is stuck in the stopping state during hibernation, then you can force stop the instance. For instructions on how to force stop the instance, see the Force stop the instance section of this article.

For more information, see Troubleshoot Amazon EC2 instance hibernation.

Force stop the instance

If your instance is stuck in the stopping state, then you can force stop the instance.

Use the Amazon EC2 console

Complete the following steps:

  1. Open the Amazon EC2 console.
  2. Choose Instances, and then select the stuck instance.
  3. Choose Instance state, select Force stop instance, and then choose Stop.
    Note: Force stop instance is only available in the console when your instance is in the stopping state. If your instance is in another state, except shutting down and terminated, then use the AWS CLI to force stop your instance.

Use the AWS CLI

Use the stop-instances command and the --force option.

Example:

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

Note: Replace i-0123ab456c789d01e with your instance ID.

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 Amazon EC2 instance stop issues.

Related information

How do I troubleshoot status check failures for my EC2 Linux instance?

AWS OFFICIALUpdated 6 months ago