Bobcares

EC2 instance stuck in the stopping state – How to fix

by | Jul 11, 2021

Wondering how to fix an EC2 instance stuck in the stopping state? We can help you!

Often EC2 users report to us that their instance appears to be “stuck” in the stopping state.

This generally, happens when there is a problem with the underlying hardware hosting the instance. Also, this issue can occur when hibernating a hibernation-enabled instance.

Here at Bobcares, we handle requests from our customers to fix similar issues as a part of our Server Management Services.

Today let’s see how our Support Engineers fix this for our customers.

How to fix EC2 instance stuck in the stopping state

We can check the most recent state of the instance with the refresh icon in the Amazon EC2 console.

Also, we can run the following describe-instances command in the AWS Command Line Interface (AWS CLI):

aws ec2 describe-instances --instance-ids your-instance-id --output json

From the result we can check the State Code and Name in the JSON response:

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

Steps to fix this error

Following are the methods that our Support Engineers follow to fix this issue:

1. Force stop the instance

We can force the instance to stop either using the console or the AWS CLI.

To force stop the instance using the console we can use the following steps:

1. Firstly, we have to open the Amazon EC2 console (https://console.aws.amazon.com/ec2/).

2. Then go to instances and select the stuck instance.

3. After that go to Instance state and take Force stop instance.

4. Finally Stop the instance.

2. Create a replacement instance

We can create a replacement instance using two of the following methods:

Method1:

Following are the steps to create a replacement instance:

1. Firstly, we have to open the Amazon EC2 console.

2. Then go to Instances and select the stuck instance.

3. After that we must choose Actions then go to Image and templates

4. And select Create Image, do the following steps:

  1. Enter a name and description for the AMI.
  2. And select No reboot.
  3. After that select Create image.

5. Now we can launch a new instance from the AMI and verify that the new instance is working.

6. Then we can select the stuck instance, and go to Actions.

7. From there go to Instance state and  Terminate instance.

If the instance also gets stuck terminating, Amazon EC2 automatically forces it to terminate within a few hours.

Method 2:

The alternate method to create a replacement instance using the console is given below.

Following are the steps:

1. Firstly, we have to select the instance and go to Description.

2. Then select Block devices.

3. After that, we can select each volume and note down the volume ID.

4. Also, we must note which volume is the root volume.

5. Now from the navigation pane, select Volumes.

6. And select each volume for the instance, and click on Actions, Create Snapshot.

7. After that, we have to select the snapshot that we just created, and click on Actions, Create Volume.

8. Next, we have to launch an instance with the same operating system as the stuck instance.

9. Here also we must ensure to note the volume ID and device name of its root volume.

10. Now, we have to select the instance that we just launched, and click on Instance state, Stop the instance.

11. After that go to Volumes, select the root volume of the stopped instance, and click on Actions, Detach Volume.

12. Then we have to select the root volume that we created from the stuck instance and attach it to the new instance as its root volume

13. We can also attach additional non-root volumes to the instance, if any.

14. From the Instances we must select the replacement instance and click on Instance state, Start the instance.

6. To verify we can select the stuck instance, and go to Actions.

7. From there select Instance state and Terminate instance.

If the instance also gets stuck terminating, Amazon EC2 automatically forces it to terminate within a few hours.

[Need assistance? We can help you]

Conclusion

To conclude, we saw the steps that our Support Techs follow to fix the EC2 instance stuck in the stopping state.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.