delete_key_pair

EC2.Client.delete_key_pair(**kwargs)

Deletes the specified key pair, by removing the public key from Amazon EC2.

See also: AWS API Documentation

Request Syntax

response = client.delete_key_pair(
    KeyName='string',
    KeyPairId='string',
    DryRun=True|False
)
Parameters
  • KeyName (string) -- The name of the key pair.
  • KeyPairId (string) -- The ID of the key pair.
  • DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
Returns

None

Examples

This example deletes the specified key pair.

response = client.delete_key_pair(
    KeyName='my-key-pair',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}