5

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?

Spirit
  • 1,154
  • 8
  • 25
  • 45
  • 1
    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). – ceejayoz Apr 20 '17 at 17:49

1 Answers1

7

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.

Matt Houser
  • 10,053
  • 1
  • 28
  • 28
  • So basically stop/restart from AWS and shutdown/reboot from Windows are the same. – Spirit Apr 20 '17 at 18:04
  • Yes. They are the same. – Matt Houser Apr 20 '17 at 18:06
  • 1
    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. – Tim Apr 20 '17 at 20:23
  • @Tim noted, and updated. – Matt Houser Apr 20 '17 at 20:30
  • 1
    @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. – Michael - sqlbot Apr 21 '17 at 01:03
  • 4
    **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 – Assambar Oct 17 '17 at 15:37