Skip to content

create_instance_connect_endpoint async

create_instance_connect_endpoint(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    subnet_id: Optional[SubnetId] = None,
    security_group_ids: Optional[SecurityGroupIdStringListRequest] = None,
    preserve_client_ip: Optional[Boolean] = None,
    client_token: Optional[String] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    ip_address_type: Optional[IpAddressType] = None,
) -> CreateInstanceConnectEndpointResult

Creates an EC2 Instance Connect Endpoint.

An EC2 Instance Connect Endpoint allows you to connect to an instance, without requiring the instance to have a public IPv4 or public IPv6 address. For more information, see Connect to your instances using EC2 Instance Connect Endpoint in the Amazon EC2 User Guide.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • subnet_id (Optional[SubnetId], default: None ) –

    The ID of the subnet in which to create the EC2 Instance Connect Endpoint.

  • security_group_ids (Optional[SecurityGroupIdStringListRequest], default: None ) –

    One or more security groups to associate with the endpoint. If you don't specify a security group, the default security group for your VPC will be associated with the endpoint.

  • preserve_client_ip (Optional[Boolean], default: None ) –

    Indicates whether the client IP address is preserved as the source. The following are the possible values.

    • true - Use the client IP address as the source.

    • false - Use the network interface IP address as the source.

    PreserveClientIp is only supported on IPv4 EC2 Instance Connect Endpoints. To use PreserveClientIp, the value for IpAddressType must be ipv4.

    Default: false

  • client_token (Optional[String], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to apply to the EC2 Instance Connect Endpoint during creation.

  • ip_address_type (Optional[IpAddressType], default: None ) –

    The IP address type of the endpoint.

    If no value is specified, the default value is determined by the IP address type of the subnet:

    • dualstack - If the subnet has both IPv4 and IPv6 CIDRs

    • ipv4 - If the subnet has only IPv4 CIDRs

    • ipv6 - If the subnet has only IPv6 CIDRs

    PreserveClientIp is only supported on IPv4 EC2 Instance Connect Endpoints. To use PreserveClientIp, the value for IpAddressType must be ipv4.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_instance_connect_endpoint(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    subnet_id: Optional["capo_ec2.types.subnet_id.SubnetId"] = None,
    security_group_ids: Optional[
        "capo_ec2.types.security_group_id_string_list_request.SecurityGroupIdStringListRequest"
    ] = None,
    preserve_client_ip: Optional["capo_ec2.types.boolean.Boolean"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
    ip_address_type: Optional[
        "capo_ec2.types.ip_address_type.IpAddressType"
    ] = None,
) -> "capo_ec2.types.create_instance_connect_endpoint_result.CreateInstanceConnectEndpointResult":
    """<p>Creates an EC2 Instance Connect Endpoint.</p> <p>An EC2 Instance Connect Endpoint allows you to connect to an instance, without requiring the instance to have a public IPv4 or public IPv6 address. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Connect-using-EC2-Instance-Connect-Endpoint.html">Connect to your instances using EC2 Instance Connect Endpoint</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        subnet_id: <p>The ID of the subnet in which to create the EC2 Instance Connect Endpoint.</p>
        security_group_ids: <p>One or more security groups to associate with the endpoint. If you don't specify a security group, the default security group for your VPC will be associated with the endpoint.</p>
        preserve_client_ip: <p>Indicates whether the client IP address is preserved as the source. The following are the possible values.</p> <ul> <li> <p> <code>true</code> - Use the client IP address as the source.</p> </li> <li> <p> <code>false</code> - Use the network interface IP address as the source.</p> </li> </ul> <note> <p> <code>PreserveClientIp</code> is only supported on IPv4 EC2 Instance Connect Endpoints. To use <code>PreserveClientIp</code>, the value for <code>IpAddressType</code> must be <code>ipv4</code>.</p> </note> <p>Default: <code>false</code> </p>
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
        tag_specifications: <p>The tags to apply to the EC2 Instance Connect Endpoint during creation.</p>
        ip_address_type: <p>The IP address type of the endpoint.</p> <p>If no value is specified, the default value is determined by the IP address type of the subnet:</p> <ul> <li> <p> <code>dualstack</code> - If the subnet has both IPv4 and IPv6 CIDRs</p> </li> <li> <p> <code>ipv4</code> - If the subnet has only IPv4 CIDRs</p> </li> <li> <p> <code>ipv6</code> - If the subnet has only IPv6 CIDRs</p> </li> </ul> <note> <p> <code>PreserveClientIp</code> is only supported on IPv4 EC2 Instance Connect Endpoints. To use <code>PreserveClientIp</code>, the value for <code>IpAddressType</code> must be <code>ipv4</code>.</p> </note>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_instance_connect_endpoint_request.CreateInstanceConnectEndpointRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_instance_connect_endpoint_result.CreateInstanceConnectEndpointResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_instance_connect_endpoint

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.create_instance_connect_endpoint.async_create_instance_connect_endpoint(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInstanceConnectEndpoint")
    )
    input_: capo_ec2.types.create_instance_connect_endpoint_request.CreateInstanceConnectEndpointRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if subnet_id is not None:
        input_["subnet_id"] = subnet_id
    if security_group_ids is not None:
        input_["security_group_ids"] = security_group_ids
    if preserve_client_ip is not None:
        input_["preserve_client_ip"] = preserve_client_ip
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if ip_address_type is not None:
        input_["ip_address_type"] = ip_address_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output