11

I am attempting to understand that if I use the command shutdown -h now on a Linux instance running on AWS, does it terminate or simply stop the instance. There doesn't appear to be any official documentation regarding it.

2
  • OK, my understanding of AWS was not as deep as I thought, so I deleted my misinformed answer. Two points: this question needs official (from AWS itself) definitions of "terminate" and "stop". And a more general way to title the question might be "When the OS tells its AWS instance to power down, what happens? Terminate? Stop? Something else? Apr 25, 2013 at 22:42
  • @Isaac Rabinovitch - Thanks. There doesn't appear to be any documentation from AWS regarding it. Apr 26, 2013 at 3:06

2 Answers 2

7

When you create a new instance, whether via the console, the EC2 API, or CloudFormation, you can specify the behavior on shutdown as either stop or terminate by the value of the InstanceInitiatedShutdownBehavior option. The default value is stop. You can change this behavior at any time after the instance is created if you want.

Stop means the instance still exists, but it is shutdown. It still has an instance-id, but its virtual RAM is discarded, as are any ephemeral (also called instance) storage volumes (but not an EBS volumes). You can get information about the instance using the API and its instance-id. You can restart the instance in the future. While it is stopped you will be not be paying for run time, though you will pay for any EBS volumes attached to the instance. Amazon's EC2 documentation here has some more details.

Terminate means that the instance no longer exists. You can't restart it, though you could always create a brand new one from scratch or from a saved snapshot.

The only time I configure an instance to terminate on shutdown is when I create one to perform just some specific task. I program it to shutdown when it has finished and saved the result elsewhere, and know that will make it terminate so I don't have to worry about remembering to go terminate it myself later.

5

It depends on how you configured the AWS instance at launch. Typically a shutdown stops the instance. If you selected Terminate on shutdown it will be terminated instead.

you are using:

# shutdown -h

so you are asking the system to halt.

Try using:

# poweroff

instead?

1
  • Great. Thanks for that. The poweroff command doesn't terminate the EC2 instance. May 5, 2021 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .