Deletes one or more SSH key pairs.
Description
When you call this operation, take note of the following items:
- After an SSH key pair is deleted, you cannot query the SSH key pair by calling the DescribeKeyPairs operation.
- If an SSH key pair is bound to one or more Elastic Compute Service (ECS) instances, the SSH key pair cannot be deleted.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeleteKeyPairs |
The operation that you want to perform. Set the value to DeleteKeyPairs. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region. You can call the DescribeRegions operation to query the most recent region list. |
KeyPairNames | String | Yes | ["skp-bp67acfmxazb41****", "skp-bp67acfmxazb42****", … "skp-bp67acfmxazb4p3***"] |
The names of SSH key pairs. The value can be a JSON array that consists of up to 100 key pair names. Separate multiple key pair names with commas (,). |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DeleteKeyPairs
&RegionId=cn-hangzhou
&KeyPairNames=["skp-bp67acfmxazb41****", "skp-bp67acfmxazb42****", … "skp-bp67acfmxazb4p3***"]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DeleteKeyPairsResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</DeleteKeyPairsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter | The input parameter "KeyPairNames" that is mandatory for processing this request is not supplied. | The error message returned because the required KeyPairNames parameter is not specified. |
400 | InvalidKeyPairNames.ValueNotSupported | The specified parameter "KeyPairNames" is not valid. | The error message returned because the specified KeyPairName parameter is invalid. |
403 | InstanceKeyPairLimitExceeded | Exceeding the allowed amount of instance which will be deleted. | The error message returned because the number of specified key pairs exceeds the upper limit. |
For a list of error codes, visit the API Error Center.