EC2InstanceConnect / Client / send_serial_console_ssh_public_key

send_serial_console_ssh_public_key#

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 in the Amazon EC2 User Guide.

See also: AWS API Documentation

Request Syntax

response = client.send_serial_console_ssh_public_key(
    InstanceId='string',
    SerialPort=123,
    SSHPublicKey='string'
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The ID of the EC2 instance.

  • SerialPort (integer) –

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

    Default: 0

  • SSHPublicKey (string) –

    [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 in the Amazon EC2 User Guide.

Return type:

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

  • EC2InstanceConnect.Client.exceptions.AuthException

  • EC2InstanceConnect.Client.exceptions.SerialConsoleAccessDisabledException

  • EC2InstanceConnect.Client.exceptions.InvalidArgsException

  • EC2InstanceConnect.Client.exceptions.ServiceException

  • EC2InstanceConnect.Client.exceptions.ThrottlingException

  • EC2InstanceConnect.Client.exceptions.EC2InstanceNotFoundException

  • EC2InstanceConnect.Client.exceptions.EC2InstanceTypeInvalidException

  • EC2InstanceConnect.Client.exceptions.SerialConsoleSessionLimitExceededException

  • EC2InstanceConnect.Client.exceptions.SerialConsoleSessionUnavailableException

  • EC2InstanceConnect.Client.exceptions.EC2InstanceStateInvalidException

  • EC2InstanceConnect.Client.exceptions.EC2InstanceUnavailableException