EC2 instance stuck in “stopping” state

Issue:
EC2 instance stuck in “stopping” state and doesn’t terminate or respond to normal stop/start actions.

Context:
This happens fairly often. Users on forums run into it when trying to stop an instance that becomes unresponsive due to high CPU usage, a kernel panic, or corrupted disk. It also happens during shutdown failures from inside the OS. AWS doesn’t let you force-stop it from the console when it’s stuck in this state for too long.

Symptoms:

  • EC2 instance shows status as “stopping” for more than a few minutes.
  • You can’t reboot, stop, or terminate the instance from the console.
  • CLI/SDK actions return success but nothing happens.
  • Instance isn’t reachable via SSH.
  • No status checks fail.

Fix:

There is no way to “unstick” a stuck EC2 instance directly. The approach is to recover the root volume and re-attach it to a healthy instance. Here’s the process:

  1. Go to EC2 Dashboard → Volumes
    Locate the root EBS volume attached to the stuck instance.
  2. Detach the Volume
    You may have to force-detach it since the instance is technically still “running.”
  3. Create a New Temporary EC2 Instance
    Use the same OS and instance type as the stuck instance if possible.
  4. Attach the Detached Volume to the New Instance
    Attach it as a secondary volume (e.g., /dev/xvdf).
  5. SSH into the Temporary Instance
    Mount the attached volume: sudo mkdir /mnt/recovery sudo mount /dev/xvdf1 /mnt/recovery
  6. Check for Issues in Logs
    Look in /mnt/recovery/var/log (especially syslog, messages, or cloud-init.log) to find out what broke.
  7. Fix Broken Configs or Delete Problematic Files
    Example: if there was a startup script causing a boot loop, remove it.
  8. Unmount and Detach Volume sudo umount /mnt/recovery
  9. Create a New Instance with the Fixed Volume as Root
    • Snapshot the fixed volume.
    • Create an AMI from it.
    • Launch a new instance using that AMI.
  10. Terminate the Stuck Instance

Note:
If none of this works or you don’t care about the data, skip steps 1–9 and just create a replacement instance. AWS will eventually stop the broken one and you can terminate it manually later.