:doc:`KeyPair <index>` / Action / delete

******
delete
******



.. py:method:: EC2.KeyPair.delete(**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 = key_pair.delete(
        KeyPairId='string',
        DryRun=True|False
    )
    
  :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.

        
  