:doc:`EC2InstanceConnect <../../ec2-instance-connect>` / Client / send_serial_console_ssh_public_key

**********************************
send_serial_console_ssh_public_key
**********************************



.. py:method:: EC2InstanceConnect.Client.send_serial_console_ssh_public_key(**kwargs)

  

  Pushes an SSH public key to the specified EC2 instance. The key remains for 60 seconds, which gives you 60 seconds to establish a serial console connection to the instance using SSH. For more information, see `EC2 Serial Console <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-serial-console.html>`__ in the *Amazon EC2 User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-instance-connect-2018-04-02/SendSerialConsoleSSHPublicKey>`_  


  **Request Syntax**
  ::

    response = client.send_serial_console_ssh_public_key(
        InstanceId='string',
        SerialPort=123,
        SSHPublicKey='string'
    )
    
  :type InstanceId: string
  :param InstanceId: **[REQUIRED]** 

    The ID of the EC2 instance.

    

  
  :type SerialPort: integer
  :param SerialPort: 

    The serial port of the EC2 instance. Currently only port 0 is supported.

     

    Default: 0

    

  
  :type SSHPublicKey: string
  :param SSHPublicKey: **[REQUIRED]** 

    The public key material. To use the public key, you must have the matching private key. For information about the supported key formats and lengths, see `Requirements for key pairs <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws>`__ in the *Amazon EC2 User Guide*.

    

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

    
    ::

      {
          'RequestId': 'string',
          'Success': True|False
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **RequestId** *(string) --* 

        The ID of the request. Please provide this ID when contacting AWS Support for assistance.

        
      

      - **Success** *(boolean) --* 

        Is true if the request succeeds and an error otherwise.

        
  
  **Exceptions**
  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.AuthException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.SerialConsoleAccessDisabledException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.InvalidArgsException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.ServiceException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.ThrottlingException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.EC2InstanceNotFoundException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.EC2InstanceTypeInvalidException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.SerialConsoleSessionLimitExceededException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.SerialConsoleSessionUnavailableException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.EC2InstanceStateInvalidException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.EC2InstanceUnavailableException`

  
  *   :py:class:`EC2InstanceConnect.Client.exceptions.SerialConsoleSessionUnsupportedException`

  