:doc:`EC2 <../../ec2>` / Client / delete_key_pair

***************
delete_key_pair
***************



.. py:method:: EC2.Client.delete_key_pair(**kwargs)

  

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

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteKeyPair>`_  


  **Request Syntax**
  ::

    response = client.delete_key_pair(
        KeyName='string',
        KeyPairId='string',
        DryRun=True|False
    )
    
  :type KeyName: string
  :param KeyName: 

    The name of the key pair.

    

  
  :type KeyPairId: string
  :param KeyPairId: 

    The ID of the key pair.

    

  
  :type DryRun: boolean
  :param DryRun: 

    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``.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Return': True|False,
          'KeyPairId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Return** *(boolean) --* 

        Is ``true`` if the request succeeds, and an error otherwise.

        
      

      - **KeyPairId** *(string) --* 

        The ID of the key pair.

        
  

  **Examples**

  This example deletes the specified key pair.
  ::

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

  
  Expected Output:
  ::

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

  