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.
Best Answer
Differences in use:
ec2-reboot-instances
requires AWS credentialsDifference in functionality:
ec2-reboot-instances
will force a hard reboot after 4 minutes if the instance hasn't cleanly shutdown. (See Documentation)In cases where the instance is responsive and can be accessed via SSH
reboot
(via SSH) will perform the same task asec2-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: