Proper way to stop/reboot a Windows EC2 instance

9,242

You have the following options:

Stop and Restart the instance from AWS commands

  • This will safely stop and restart your EC2 instance.
  • The instance will be in a "stopped" state until you restart it.
  • It may move your EC2 instance to different hardware.
  • It will allocate a new public IP address if you have not assigned an Elastic IP address.

Stop the instance from Windows "Start Menu" commands (or shutdown -h command in Linux) and restart the instance from AWS commands

  • This will safely stop and restart your EC2 instance.
  • The instance will be in a "stopped" state until you restart it.
  • It may move your EC2 instance to different hardware.
  • It will allocate a new public IP address if you have not assigned an Elastic IP address.

Reboot the instance from AWS commands

  • This will safely restart your EC2 instance.
  • The instance will remain in a "running" state.
  • The EC2 instance will remain on the same hardware.
  • The EC2 instance will maintain it's existing public IP address.

Reboot the instance from Windows "Start Menu" (or shutdown -r command in Linux)

  • This will safely restart your EC2 instance.
  • The instance will remain in a "running" state.
  • The EC2 instance will remain on the same hardware.
  • The EC2 instance will maintain it's existing public IP address.

Additional Notes

Whenever possible, AWS will gracefully shutdown the OS for both stops and reboots.

If you use AWS commands to stop or restart your EC2 instances, you may face "unexpected shutdown" alerts in your Windows instances. Mostly, these are harmless questions by the OS to the admin, not notifications of errors.

When using AWS commands to stop your EC2 instance, if it does not stop, you can retry with the "force" option. Using this option does not gracefully shutdown the OS and your filesystem should be checked on next start.

Share:
9,242

Related videos on Youtube

Spirit
Author by

Spirit

IT Specialist, Sysadmin and Tech Addict. Expertise: Cisco, VMware, Windows (all)

Updated on September 18, 2022

Comments

  • Spirit
    Spirit over 1 year

    I recently started with AWS and I need to stop/reboot some EC2 Windows instances. The instances are with EBS volumes.

    Is there any difference if I use the Shutdown/Reboot Windows option vs Stop/Reboot from the AWS Console?

    • ceejayoz
      ceejayoz about 7 years
      I know a "Stop" in the AWS console may result in the instance being launched on a different host when it's started back up (particularly if the instance's host is scheduled for maintenance).
  • Spirit
    Spirit about 7 years
    So basically stop/restart from AWS and shutdown/reboot from Windows are the same.
  • Matt Houser
    Matt Houser about 7 years
    Yes. They are the same.
  • Tim
    Tim about 7 years
    Fourth part, suggest you change first bullet point from "stop and restart" to just "restart". Stop and start has a distinct meaning in AWS, to move the instance to new hardware, whereas restart does not. I know your later bullet points say this but best to be clear. I also wonder if a restart from the AWS console does a hard shutdown without notifying the OS, or if AWS somehow gracefully shuts down the OS before doing anything at the hypervisor level.
  • Matt Houser
    Matt Houser about 7 years
    @Tim noted, and updated.
  • Michael - sqlbot
    Michael - sqlbot about 7 years
    @Tim given that a console reboot simulates a control-alt-delete to reboot Linux instances, it seems likely that it does something similarly appropriate for Windows. A console reboot should be a "soft" operation, doing nothing at the hypervisor beyond simply telling the OS that it should reboot.
  • Assambar
    Assambar over 6 years
    Disclaimer: this should be a comment to @Matt_Houser's answer above, but I don't have the reputation for that. ---------- I've been working on an application that needs to do graceful cleanup during Windows shutdown. Empirically, it seems that when doing stop or reboot from the EC2 console Windows is shut down forcefully, in difference to being shut down from the Windows UI. Our observations are: when terminating from the EC2 console, for the WM_QUERRYENDSESSION message we get the ENDSESSION_CRITICAL flag in the logoffOptions and we get killed in about 4-5 seconds. Doing a regular shut