| Did this page help you? Yes No Tell us about it... |
By default, when you initiate a shutdown from within an EBS-backed instance, the instance stops.
You can change this so the instance terminates instead.
You just modify the InstanceInitiatedShutdownBehavior
attribute for the instance. You can do this while the instance is either running or stopped.
To change the InstanceInitiatedShutdownBehavior attribute
View the current value for the flag with the following command.
PROMPT>ec2-describe-instance-attributeinstance_id--instance-initiated-shutdown-behavior
Sample response:
instanceInitiatedShutdownBehavior i-87ad5eec stop
Change the flag's value to terminate with the following command.
PROMPT>ec2-modify-instance-attributeinstance_id--instance-initiated-shutdown-behavior terminate
Sample response:
instanceInitiatedShutdownBehavior i-87ad5eec terminate
You can toggle the attribute between stop and terminate as often as you
want.
To change the InstanceInitiatedShutdownBehavior attribute
Issue the following Query request to get the current value of the attribute.
https://ec2.amazonaws.com/ ?Action=DescribeInstanceAttribute &InstanceId=i-87ad5eec &Attribute=instanceInitiatedShutdownBehavior &...auth parameters...
For information about the auth parameters, go to Common Query Parameters in the Amazon Elastic Compute Cloud API Reference.
Following is an example response.
<DescribeInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/">
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
<instanceId>i-5d7e8e36</instanceId>
<instanceInitiatedShutdownBehavior>
<value>stop</value>
</instanceInitiatedShutdownBehavior>
</DescribeInstanceAttributeResponse>Issue the following Query request to change the attribute's value.
https://ec2.amazonaws.com/ ?Action=ModifyInstanceAttribute &InstanceId=i-87ad5eec &Attribute=instanceInitiatedShutdownBehavior &Value=terminate &...auth parameters...
Following is an example response.
<ModifyInstanceAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </ModifyInstanceAttributeResponse>
You can toggle the attribute between stop and terminate as often as you
want.