Change the instance initiated shutdown behavior - Amazon Elastic Compute Cloud

Change the instance initiated shutdown behavior

By default, when you initiate a shutdown from an Amazon EBS backed instance (using a command such as shutdown or poweroff), the instance stops. You can change this behavior so that the instance terminates instead by changing the InstanceInitiatedShutdownBehavior attribute for the instance. You can change this attribute while the instance is running or stopped.

The halt command doesn't initiate a shutdown. If used, the instance doesn't terminate; instead, it places the CPU into HLT and the instance continues to run.

Note

The InstanceInitiatedShutdownBehavior attribute only applies when you perform a shutdown from the operating system of the instance itself. It doesn't apply when you stop an instance using the StopInstances API or the Amazon EC2 console.

You can change the InstanceInitiatedShutdownBehavior attribute using the Amazon EC2 console or the command line.

Console
To change the instance initiated shutdown behavior
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Instances.

  3. Select the instance.

  4. Choose Actions, Instance settings, Change shutdown behavior.

    Shutdown behavior displays the current behavior.

  5. To change the behavior, for Shutdown behavior, choose Stop or Terminate.

  6. Choose Save.

Command line
To change the instance initiated shutdown behavior

You can use one of the following commands. For more information about these command line interfaces, see Access Amazon EC2.