send_serial_console_ssh_public_key
¶
send_serial_console_ssh_public_key(
instance_id: InstanceId,
ssh_public_key: SSHPublicKey,
*,
config_overrides: Optional[EC2InstanceConnectClientConfig] = None,
serial_port: Optional[SerialPort] = None,
) -> SendSerialConsoleSSHPublicKeyResponse
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.
Parameters:
-
instance_id(InstanceId) –The ID of the EC2 instance.
-
serial_port(Optional[SerialPort], default:None) –The serial port of the EC2 instance. Currently only port 0 is supported.
Default: 0
-
ssh_public_key(SSHPublicKey) –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.
Raises:
-
AuthException–Either your AWS credentials are not valid or you do not have access to the EC2 instance.
-
EC2InstanceNotFoundException–The specified instance was not found.
-
EC2InstanceStateInvalidException–Unable to connect because the instance is not in a valid state. Connecting to a stopped or terminated instance is not supported. If the instance is stopped, start your instance, and try to connect again.
-
EC2InstanceTypeInvalidException–The instance type is not supported for connecting via the serial console. Only Nitro instance types are currently supported.
-
EC2InstanceUnavailableException–The instance is currently unavailable. Wait a few minutes and try again.
-
InvalidArgsException–One of the parameters is not valid.
-
SerialConsoleAccessDisabledException–Your account is not authorized to use the EC2 Serial Console. To authorize your account, run the EnableSerialConsoleAccess API. For more information, see EnableSerialConsoleAccess in the Amazon EC2 API Reference.
-
SerialConsoleSessionLimitExceededException–The instance currently has 1 active serial console session. Only 1 session is supported at a time.
-
SerialConsoleSessionUnavailableException–Unable to start a serial console session. Please try again.
-
SerialConsoleSessionUnsupportedException–Your instance's BIOS version is unsupported for serial console connection. Reboot your instance to update its BIOS, and then try again to connect.
-
ServiceException–The service encountered an error. Follow the instructions in the error message and try again.
-
ThrottlingException–The requests were made too frequently and have been throttled. Wait a while and try again. To increase the limit on your request frequency, contact AWS Support.
-
UnknownServiceError–The service returned an error code this client does not model.