Interface Ec2InstanceConnectAsyncClient
- All Superinterfaces:
AutoCloseable
,AwsClient
,SdkAutoCloseable
,SdkClient
builder()
method.The asynchronous client performs non-blocking I/O when configured with any
SdkAsyncHttpClient
supported in the SDK. However, full non-blocking is not guaranteed as the async client may
perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API
call.
This is the Amazon EC2 Instance Connect API Reference. It provides descriptions, syntax, and usage examples for each of the actions for Amazon EC2 Instance Connect. Amazon EC2 Instance Connect enables system administrators to publish one-time use SSH public keys to EC2, providing users a simple and secure way to connect to their instances.
To view the Amazon EC2 Instance Connect content in the Amazon EC2 User Guide, see Connect to your Linux instance using EC2 Instance Connect.
For Amazon EC2 APIs, see the Amazon EC2 API Reference.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Value for looking up the service's metadata from theServiceMetadataProvider
.static final String
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Create a builder that can be used to configure and create aEc2InstanceConnectAsyncClient
.create()
Create aEc2InstanceConnectAsyncClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
.sendSerialConsoleSSHPublicKey
(Consumer<SendSerialConsoleSshPublicKeyRequest.Builder> sendSerialConsoleSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance.sendSerialConsoleSSHPublicKey
(SendSerialConsoleSshPublicKeyRequest sendSerialConsoleSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance.sendSSHPublicKey
(Consumer<SendSshPublicKeyRequest.Builder> sendSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance for use by the specified user.sendSSHPublicKey
(SendSshPublicKeyRequest sendSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance for use by the specified user.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationMethods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
Methods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider
.- See Also:
-
-
Method Details
-
sendSSHPublicKey
default CompletableFuture<SendSshPublicKeyResponse> sendSSHPublicKey(SendSshPublicKeyRequest sendSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance for use by the specified user. The key remains for 60 seconds. For more information, see Connect to your Linux instance using EC2 Instance Connect in the Amazon EC2 User Guide.
- Parameters:
sendSshPublicKeyRequest
-- Returns:
- A Java Future containing the result of the SendSSHPublicKey operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()
to retrieve the underlying exception.- AuthException Either your AWS credentials are not valid or you do not have access to the EC2 instance.
- InvalidArgsException One of the parameters is not valid.
- 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.
- 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.
- Ec2InstanceUnavailableException The instance is currently unavailable. Wait a few minutes and try again.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- Ec2InstanceConnectException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
sendSSHPublicKey
default CompletableFuture<SendSshPublicKeyResponse> sendSSHPublicKey(Consumer<SendSshPublicKeyRequest.Builder> sendSshPublicKeyRequest) Pushes an SSH public key to the specified EC2 instance for use by the specified user. The key remains for 60 seconds. For more information, see Connect to your Linux instance using EC2 Instance Connect in the Amazon EC2 User Guide.
This is a convenience which creates an instance of the
SendSshPublicKeyRequest.Builder
avoiding the need to create one manually viaSendSshPublicKeyRequest.builder()
- Parameters:
sendSshPublicKeyRequest
- AConsumer
that will call methods onSendSshPublicKeyRequest.Builder
to create a request.- Returns:
- A Java Future containing the result of the SendSSHPublicKey operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()
to retrieve the underlying exception.- AuthException Either your AWS credentials are not valid or you do not have access to the EC2 instance.
- InvalidArgsException One of the parameters is not valid.
- 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.
- 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.
- Ec2InstanceUnavailableException The instance is currently unavailable. Wait a few minutes and try again.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- Ec2InstanceConnectException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
sendSerialConsoleSSHPublicKey
default CompletableFuture<SendSerialConsoleSshPublicKeyResponse> sendSerialConsoleSSHPublicKey(SendSerialConsoleSshPublicKeyRequest sendSerialConsoleSshPublicKeyRequest) 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:
sendSerialConsoleSshPublicKeyRequest
-- Returns:
- A Java Future containing the result of the SendSerialConsoleSSHPublicKey operation returned by the
service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()
to retrieve the underlying exception.- AuthException Either your AWS credentials are not valid or you do not have access to the EC2 instance.
- 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.
- InvalidArgsException One of the parameters is not valid.
- 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.
- Ec2InstanceNotFoundException The specified instance was not found.
- Ec2InstanceTypeInvalidException The instance type is not supported for connecting via the serial console. Only Nitro instance types are currently supported.
- 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.
- 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.
- Ec2InstanceUnavailableException The instance is currently unavailable. Wait a few minutes and 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.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- Ec2InstanceConnectException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
sendSerialConsoleSSHPublicKey
default CompletableFuture<SendSerialConsoleSshPublicKeyResponse> sendSerialConsoleSSHPublicKey(Consumer<SendSerialConsoleSshPublicKeyRequest.Builder> sendSerialConsoleSshPublicKeyRequest) 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.
This is a convenience which creates an instance of the
SendSerialConsoleSshPublicKeyRequest.Builder
avoiding the need to create one manually viaSendSerialConsoleSshPublicKeyRequest.builder()
- Parameters:
sendSerialConsoleSshPublicKeyRequest
- AConsumer
that will call methods onSendSerialConsoleSshPublicKeyRequest.Builder
to create a request.- Returns:
- A Java Future containing the result of the SendSerialConsoleSSHPublicKey operation returned by the
service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()
to retrieve the underlying exception.- AuthException Either your AWS credentials are not valid or you do not have access to the EC2 instance.
- 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.
- InvalidArgsException One of the parameters is not valid.
- 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.
- Ec2InstanceNotFoundException The specified instance was not found.
- Ec2InstanceTypeInvalidException The instance type is not supported for connecting via the serial console. Only Nitro instance types are currently supported.
- 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.
- 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.
- Ec2InstanceUnavailableException The instance is currently unavailable. Wait a few minutes and 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.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- Ec2InstanceConnectException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
serviceClientConfiguration
Description copied from interface:SdkClient
The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfiguration
in interfaceAwsClient
- Specified by:
serviceClientConfiguration
in interfaceSdkClient
- Returns:
- SdkServiceClientConfiguration
-
create
Create aEc2InstanceConnectAsyncClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
. -
builder
Create a builder that can be used to configure and create aEc2InstanceConnectAsyncClient
.
-