Amazon Elastic Compute Cloud
API Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

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.

You can stop, start, and terminate EBS-backed instances. You can only terminate S3-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted. For more information about the differences between stopping and terminating instances, see Stopping Instances in the Amazon Elastic Compute Cloud User Guide

Request Parameters

InstanceId.n

One or more instance IDs.

Type: String

Default: None

Required: Yes

Response Elements

The following elements are returned in a TerminateInstancesResponse element.

requestId

The ID of the request.

Type: xsd:string

instancesSet

A list of instance state changes. Each change is wrapped in an item element.

Type: InstanceStateChangeType

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/2013-02-01/">
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
  <instancesSet>
    <item>
      <instanceId>i-3ea74257</instanceId>
      <currentState>
        <code>32</code>
        <name>shutting-down</name>
      </currentState>
      <previousState>
        <code>16</code>
        <name>running</name>
      </previousState>
    </item>
  </instancesSet>
</TerminateInstancesResponse>