Amazon Elastic Compute Cloud
API Reference (API Version 2011-12-15)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid 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]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, go to the "Stop/Start" and "Instance Termination" in Basics of Amazon EBS-Backed AMIS and Instances in the Amazon EC2 User Guide.

Request Parameters

NameDescriptionRequired

InstanceId.n

One or more instance IDs.

Type: String

Default: None

Yes

Response Elements

The elements in the following table are wrapped in a TerminateInstancesResponse structure.

NameDescription

requestId

The ID of the request.

Type: xsd:string

instancesSet

List of instance state changes. Each change's information 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/2011-12-15/">
  <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>