AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to SendSerialConsoleSSHPublicKeyAsync.

Namespace: Amazon.EC2InstanceConnect
Assembly: AWSSDK.EC2InstanceConnect.dll
Version: 3.x.y.z

Syntax

C#
public virtual SendSerialConsoleSSHPublicKeyResponse SendSerialConsoleSSHPublicKey(
         SendSerialConsoleSSHPublicKeyRequest request
)

Parameters

request
Type: Amazon.EC2InstanceConnect.Model.SendSerialConsoleSSHPublicKeyRequest

Container for the necessary parameters to execute the SendSerialConsoleSSHPublicKey service method.

Return Value


The response from the SendSerialConsoleSSHPublicKey service method, as returned by EC2InstanceConnect.

Exceptions

ExceptionCondition
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.

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5

See Also