TerminateInstances
Description
Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call will succeed.
Terminated instances will remain visible after termination (approximately one hour).
![]() | Note |
|---|---|
By default, Amazon EC2 deletes all Amazon EBS volumes that were attached when the instance launched. Amazon EBS volumes attached after instance launch continue running. |
Request Parameters
| Name | Description | Required |
|---|---|---|
| The instance ID. Type: String Default: None | Yes |
Response Elements
| Name | Description |
|---|---|
|
Type: |
Ancestor: None
Children: requestId, instancesSet
requestId
The ID of the request.
Type: xsd:string
Ancestor: TerminateInstancesResponseType
Children: None
instancesSet
Instances set.
Type: InstanceStateChangeSetType
Ancestor: TerminateInstancesResponseType
Children: item
item
The item element.
Type: InstanceStateChangeType
Ancestor: instancesSet
Children: instanceId, currentState, and previousState
instanceId
The instance ID.
Type: xsd:string
Ancestor: item
Children: None
currentState
The current state of the instance.
Type: InstanceStateType
Ancestor: item
Children: code, name
code
A 16-bit unsigned integer. The high byte is an opaque internal value and should be ignored. The low byte is set based on the state represented:
Type: xsd:int
Valid Values: 0 (pending) | 16 (running) | 32 (shutting-down) | 48 (terminated) | 64 (stopping) | 80 (stopped)
Ancestor: currentState
Children: None
name
The current state of the instance.
Type: xsd:string
Valid Values: pending | running | shutting-down | terminated | stopping | stopped
Ancestor: currentState
Children: None
previousState
The previous state of the instance.
Type: InstanceStateType
Ancestor: item
Children: code, name
code
A 16-bit unsigned integer. The high byte is an opaque internal value and should be ignored. The low byte is set based on the state represented:
Type: xsd:int
Valid Values: 0 (pending) | 16 (running) | 32 (shutting-down) | 48 (terminated) | 64 (stopping) | 80 (stopped)
Ancestor: previousState
Children: None
name
The current state of the instance.
Type: xsd:string
Valid Values: pending | running | shutting-down | terminated | stopping | stopped
Ancestor: previousState
Children: None
Examples
Example Request
This example terminates the i-3ea74257 instance.
https://ec2.amazonaws.com/?Action=TerminateInstances&InstanceId.1=i-3ea74257&AuthParams
Example Response
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-10-31/">
<instancesSet>
<item>
<instanceId>i-3ea74257</instanceId>
<shutdownState>
<code>32</code>
<name>shutting-down</name>
</shutdownState>
<previousState>
<code>16</code>
<name>running</name>
</previousState>
</item>
</instancesSet>
</TerminateInstancesResponse>
![[Note]](note.png)