Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stopping an linux aws instance from linux command line

Is there a way to stop and AWS ec2 instance from the VM itself? If i start a ec2 linux based instance, is there a way for me to stop that instance by giving some linux command like "shutdown now"?

like image 376
user2779540 Avatar asked Apr 03 '14 14:04

user2779540


2 Answers

It's working with

shutdown -h now

or

shutdown -h +10

If you don't use "-h" parameter to halt, the instance will keep on running state.

like image 68
MikeRogers Avatar answered Oct 27 '22 07:10

MikeRogers


Yes, with a couple of caveats.

  1. If you are using an instance store backed instance, your only option will be to terminate. Without EBS volumes, the instance cannot exist in a stopped state.

  2. There is also a flag that can be set on the instance as to how instance initiated shutdown is handled. This can be stop or terminate. If you want to stop your instance, make sure that this flag is configured correctly.

Other than that, you would use the normal Linux shutdown commands. shutdown now

like image 33
datasage Avatar answered Oct 27 '22 06:10

datasage