Does shutdown -h now on a Linux AWS instance stop or terminate the instance?

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.


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?