EC2InstanceConnect

Client

class EC2InstanceConnect.Client

A low-level client representing AWS 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.

import boto3

client = boto3.client('ec2-instance-connect')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
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
send_ssh_public_key(**kwargs)

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 .

See also: AWS API Documentation

Request Syntax

response = client.send_ssh_public_key(
    InstanceId='string',
    InstanceOSUser='string',
    SSHPublicKey='string',
    AvailabilityZone='string'
)
Parameters
  • InstanceId (string) --

    [REQUIRED]

    The ID of the EC2 instance.

  • InstanceOSUser (string) --

    [REQUIRED]

    The OS user on the EC2 instance for whom the key can be used to authenticate.

  • SSHPublicKey (string) --

    [REQUIRED]

    The public key material. To use the public key, you must have the matching private key.

  • AvailabilityZone (string) --

    [REQUIRED]

    The Availability Zone in which the EC2 instance was launched.

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.InvalidArgsException
  • EC2InstanceConnect.Client.exceptions.ServiceException
  • EC2InstanceConnect.Client.exceptions.ThrottlingException
  • EC2InstanceConnect.Client.exceptions.EC2InstanceNotFoundException

Paginators

The available paginators are: