Examples#
Index > EC2InstanceConnect > Examples
Auto-generated documentation for EC2InstanceConnect type annotations stubs module mypy-boto3-ec2-instance-connect.
Client#
Implicit type annotations#
Can be used with boto3-stubs[ec2-instance-connect]
package installed.
Write your EC2InstanceConnect
code as usual,
type checking and code completion should work out of the box.
# EC2InstanceConnectClient usage example
from boto3.session import Session
session = Session()
client = session.client("ec2-instance-connect") # (1)
result = client.send_serial_console_ssh_public_key() # (2)
- client: EC2InstanceConnectClient
- result: SendSerialConsoleSSHPublicKeyResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[ec2-instance-connect]
or a standalone mypy_boto3_ec2_instance_connect
package, you have to explicitly specify client: EC2InstanceConnectClient
type annotation.
All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.
# EC2InstanceConnectClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_ec2_instance_connect.client import EC2InstanceConnectClient
from mypy_boto3_ec2_instance_connect.type_defs import SendSerialConsoleSSHPublicKeyResponseTypeDef
from mypy_boto3_ec2_instance_connect.type_defs import SendSerialConsoleSSHPublicKeyRequestRequestTypeDef
session = Session()
client: EC2InstanceConnectClient = session.client("ec2-instance-connect")
kwargs: SendSerialConsoleSSHPublicKeyRequestRequestTypeDef = {...}
result: SendSerialConsoleSSHPublicKeyResponseTypeDef = client.send_serial_console_ssh_public_key(**kwargs)