gotchaMinor
what is difference between "sudo shutdown now" versus "aws ec2 stop-instances"
Viewed 0 times
whatversusinstancesec2shutdowndifferencenowbetweenstopaws
Problem
When logged onto a AWS EC2 instance say some Ubuntu box and I issue
how is that different from stopping the same instance using
either way I see the instance gets into the state of
sudo shutdown nowhow is that different from stopping the same instance using
aws ec2 stop-instances --instance-ids $curr_instanceid --region $AWS_REGIONeither way I see the instance gets into the state of
stopped and it will transition into state running once this is runaws ec2 start-instances --instance-ids $curr_instanceid --region $AWS_REGIONSolution
Just to state the obvious for junior folks who might come across this:
Aside from the obvious difference in invocation, the shutdown is the same.
When you stop or hibernate an instance, we shut it down. You can restart your instance at any time. Before stopping or hibernating an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM, but hibernating an instance does preserve data stored in RAM. If an instance cannot hibernate successfully, a normal shutdown occurs.
Source: stop-instances documentation
The
When
sudo shutdown now requires access to the operating system (via SSH keys, inbound security groups, etc), while aws ec2 stop-instances is an AWS CLI command which simply requires API authentication (via IAM credentials or STS tokens).Aside from the obvious difference in invocation, the shutdown is the same.
When you stop or hibernate an instance, we shut it down. You can restart your instance at any time. Before stopping or hibernating an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM, but hibernating an instance does preserve data stored in RAM. If an instance cannot hibernate successfully, a normal shutdown occurs.
Source: stop-instances documentation
The
--hibernate flag defaults to false, so a normal shutdown is triggered immediately by your CLI command.When
--hibernate is true, the suspend-to-disk process differs from a regular shutdown (such as sudo shutdown now), and is further documented here.Context
StackExchange DevOps Q#13155, answer score: 1
Revisions (0)
No revisions yet.