Terminate Instances operation for the Amazon EC2 REST adapter
The Terminate Instances operation enables you to shut down one or more Amazon EC2 instances.
If you invoke the Terminate Instances operation for an instance more than once, the operation still executes successfully.
The following figure shows a sample <items> XML element for the Terminate Instances operation.
Sample <items> XML element for the Terminate Instances operation
<item>
<parameters>
<instances-set>
<!--Zero or more repetitions:-->
<item>
<instance-id></instance-id>
</item>
</instances-set>
</parameters>
</item>
</items>
The following table describes the elements for this adapter request.
Adapter request elements for the Terminate Instances operation
Element | Definition | Required |
---|---|---|
<access-key> | Specifies the Amazon Web Services (AWS) access key You need to generate the AWS access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<secret-key> | Specifies the AWS secret access key You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<session-token> | Specifies the temporary session token generated using the AWS APIs. | Conditional; You must specify the Access Key and Secret Key as well in the configuration or the adapter request, else the <session-token> value is ignored. |
<region> | Specifies the region with which you want the adapter to communicate Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions. Valid values:
| No |
<operation-name> | Specifies the name of the operation: terminate-instances | Yes |
<instance-set> | Contains one or more instance IDs corresponding to the instances that you want to terminate | Yes |
The following figure shows a sample adapter request for the Terminate Instances operation.
Sample adapter request for the Terminate Instances operation
<operation-name>terminate-instances</operation-name>
<parameters>
<items>
<item>
<parameters>
<instances-set>
<item>
<instance-id>i-f2cc89fb</instance-id>
</item>
</instances-set>
</parameters>
</item>
</items>
</parameters>
</amazon-ec2-rest-request>
The following figure shows the response for the sample Terminate Instances operation.
Sample adapter response for the Terminate Instances operation
<metadata>
<status>success</status>
</metadata>
<TerminateInstancesResponse>
<instancesSet>
<item>
<instanceId>i-f2cc89fb</instanceId>
<currentState>
<code>32</code>
<name>shutting-down</name>
</currentState>
<previousState>
<code>16</code>
<name>running</name>
</previousState>
</item>
</instancesSet>
</TerminateInstancesResponse>
</amazon-ec2-rest-response>