aws ec2 delete-key-pair
Deletes the specified key pair, by removing the public key from Amazon EC2. AWS CLI reference
1 example 3 options Its page in the AWS CLI reference
Examples
To delete a key pair
The following delete-key-pair example deletes the specified key pair.
aws ec2 delete-key-pair --key-name my-key-pairIdentify--key-nameThe name of the key pair.Its output
{
"Return": true,
"KeyPairId": "key-03c8d3aceb53b507"
}For more information, see Create and delete key pairs in the AWS Command Line Interface User Guide.
Options
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.--key-nameThe name of the key pair.--key-pair-idThe ID of the key pair.