17

What are the differences, if any, between invoking reboot on an EC2 instance's command line and issuing the ec2-reboot-instances command from the AWS Command Line Tools on another machine?

Does ec2-reboot-instances do anything that sending reboot over an SSH session won't do, such as handling environmental things specific to AWS?

Is there a preference between the two commands?

In my specific case, I'm using the Java library to access the AWS API rather than the command line tool, but it still invokes the same command on AWS. The Java library is more verbose than the command line tool, so it would be easier to send the reboot command over SSH, but I'd like to understand if there are any other considerations that would make it worth using the AWS API approach.

13

Differences in use:

  • No SSH access required (can be run from any computer, or even the AWS console)
  • ec2-reboot-instances requires AWS credentials
  • Can easily script for multiple instances (easier to integrate with other AWS services)

Difference in functionality:

  • ec2-reboot-instances will force a hard reboot after 4 minutes if the instance hasn't cleanly shutdown. (See Documentation)
  • The command does not confirm success - the reboot request is queued but you are not informed if it worked or if a hard start is required, etc (you are informed of outright failed commands - e.g. permissions problems, etc)
  • There is a slight delay in execution of command - usually not noticable

In cases where the instance is responsive and can be accessed via SSH reboot (via SSH) will perform the same task as ec2-reboot-instances.


As an additional point of mention, reboots from SSH will suffice for scheduled maintenance (i.e. you do not need to use ec2-reboot-instances). As per the documentation:

Instance reboots are reboots of your virtual instance, and are equivalent to an operating system reboot.

Managing your own instance reboots is very straightforward. ...you can also reboot your instance from the operating system of your instance.

3
  • Will a non-EC2 reboot command trigger scheduled maintenance events?
    – ceejayoz
    Jan 18 '12 at 2:38
  • @ceejayoz: Yes it will - updated the answer to mention it.
    – cyberx86
    Jan 18 '12 at 2:48
  • I have a situation where issuing sudo reboot resets the attached EBS volume to the file system state as when the AMI was created...and restarting from the Console does not. I wish I could provide more details...but yeah it's weird.
    – Carl G
    May 7 '18 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.