5.2.15 Delete a virtual server
Function
This plugin can delete instances from an Amazon EC2 environment. The plugin can also delete all network interfaces connected to the instance.
The required server is shown as follows:
- AWS control server (execution-target server)
This is a server on which AWS Tools for Windows PowerShell (hereinafter referred to "AWS Tools") is installed. This product can forward plugins to the server to be executed.
- Instance
This is a regular virtual server in an Amazon EC2 environment.
The scripts in this plugin execute the following AWS Tools commandlets:
(1) Deleting an instance
- Stop-EC2Instance -Instance instance-ID (the value of the AWS.instanceId property)
-Terminate
-Force
After executing the above commandlets, make sure that the status of the deleted instance is "terminated".
(2) Deleting all network interfaces connected to the instance.
- Remove-EC2NetworkInterface -NetworkInterfaceId network-interface-ID-obtained-by-Get-EC2Instance-commandlet
-Force
After executing the above commandlets, make sure that the deleted network interfaces do not exist.
For details about the AWS Tools commandlets, refer to "AWS Tools for Windows PowerShell Cmdlet Reference" in the AWS document.
Use situation
Use this plugin to delete instances from an Amazon EC2 environment.
Prerequisites
For the most recent information about the prerequisite products on the execution-target server, supported OSs for the prerequisite products on the execution-target server, and prerequisite products on the execution-target system, see the Release Notes.
In addition, the following OS and products use abbreviations. For the abbreviations of OS and products, see the "Preface".
Prerequisite products on the execution-target server:
- AWS Tools for Windows PowerShell
- Microsoft .Net Framework 3.5 or later
Supported OSs for the prerequisite products on the execution-target server:
- Windows Server
Prerequisite products in the execution-target system:
None.
Cautions
(1) Do not specify character strings that include a double quotation mark (") or a single quotation mark (') for the properties of this plugin.
(2) An instance will be deleted even if a user logs in to the instance.
(3) The deleted instance will be displayed on the console for a certain duration, and its status can be obtained. However, the instance can no longer be started.
(4) If this plugin abnormally ends with the return value of 1, the network interface that was added to the instance will remain.
(5) For additional remarks, refer to "AWS Tools for Windows PowerShell Cmdlet Reference" in the AWS document.
Execution privilege
(1) The policy must be set to allow an IAM user to log in to AWS to perform the following actions:
- Deleting instances and obtaining instance statuses
- Deleting network interfaces
Version
02.00.01
Plug-in tags
Delete VM,AWS
Plug-in name displayed in the task log
awsDeleteVM
Return code
0: Normal
1: Error (error detected after deleting the instance) Network interface connection error
12: Error (mistake by user) Invalid property
23: Error (invalid environment) The environment requirements have not been met.
27: Error (Check with the task log regarding the error details.) Unidentified error
41: Error (error detected in the component) Property not entered (An error was detected in the component script.)
Property list
The following table lists the properties:
Property key |
Property name |
Description |
Default value |
I/O type |
Required |
---|---|---|---|---|---|
plugin.destinationHost |
Host name of the execution target server |
Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported. |
-- |
Input |
R |
AWS.accessKeyId |
Access key ID |
Specify the access key ID for connecting to AWS. |
-- |
Input |
R |
AWS.secretAccessKey |
Secret access key |
Specify the secret access key for connecting to AWS. |
-- |
Input |
R |
AWS.region |
Region |
Specify an AWS region that is a connection destination. |
-- |
Input |
R |
AWS.instanceId |
Instance ID |
Specify the ID of the instance. |
-- |
Input |
R |
AWS.checkInstanceDeletionCount |
Instance status (deleted) check count |
Specify the number of times to check whether the instance has been deleted. The maximum waiting time is determined by this count and the instance status (deleted) check interval. This property is used to check whether network interfaces have been deleted. |
-- |
Input |
R |
AWS.checkInstanceDeletionInterval |
Instance status (deleted) check interval |
Specifies an interval in seconds for checking the completion of deleting an instance. This property is also used to check the completion of deleting network interfaces. |
-- |
Input |
R |
common.returnValue |
Return value for the plugin |
The return value of this plugin stored. |
-- |
Output |
O |