:doc:`Transfer <../../transfer>` / Client / test_connection

***************
test_connection
***************



.. py:method:: Transfer.Client.test_connection(**kwargs)

  

  Tests whether your SFTP connector is set up successfully. We highly recommend that you call this operation to test your ability to transfer files between local Amazon Web Services storage and a trading partner's SFTP server.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/transfer-2018-11-05/TestConnection>`_  


  **Request Syntax**
  ::

    response = client.test_connection(
        ConnectorId='string'
    )
    
  :type ConnectorId: string
  :param ConnectorId: **[REQUIRED]** 

    The unique identifier for the connector.

    

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

    
    ::

      {
          'ConnectorId': 'string',
          'Status': 'string',
          'StatusMessage': 'string',
          'SftpConnectionDetails': {
              'HostKey': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ConnectorId** *(string) --* 

        Returns the identifier of the connector object that you are testing.

        
      

      - **Status** *(string) --* 

        Returns ``OK`` for successful test, or ``ERROR`` if the test fails.

        
      

      - **StatusMessage** *(string) --* 

        Returns ``Connection succeeded`` if the test is successful. Or, returns a descriptive error message if the test fails. The following list provides troubleshooting details, depending on the error message that you receive.

         

        
        * Verify that your secret name aligns with the one in Transfer Role permissions.
         
        * Verify the server URL in the connector configuration , and verify that the login credentials work successfully outside of the connector.
         
        * Verify that the secret exists and is formatted correctly.
         
        * Verify that the trusted host key in the connector configuration matches the ``ssh-keyscan`` output.
        

        
      

      - **SftpConnectionDetails** *(dict) --* 

        Structure that contains the SFTP connector host key.

        
        

        - **HostKey** *(string) --* 

          The SSH public key of the remote SFTP server. This is returned during the initial connection attempt when you call ``TestConnection``. It allows you to retrieve the valid server host key to update the connector when you are unable to obtain it in advance.

          
    
  
  **Exceptions**
  
  *   :py:class:`Transfer.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`Transfer.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Transfer.Client.exceptions.InternalServiceError`

  
  *   :py:class:`Transfer.Client.exceptions.ServiceUnavailableException`

  