Skip to content

create_connection

create_connection(
    location: LocationCode,
    bandwidth: Bandwidth,
    connection_name: ConnectionName,
    *,
    config_overrides: Optional[DirectConnectClientConfig] = None,
    lag_id: Optional[LagId] = None,
    tags: Optional[TagList] = None,
    provider_name: Optional[ProviderName] = None,
    request_mac_sec: Optional[RequestMACSec] = None,
    billing_mode: Optional[RequestBillingMode] = None,
) -> Connection

Creates a connection between a customer network and a specific Direct Connect location.

A connection links your internal network to an Direct Connect location over a standard Ethernet fiber-optic cable. One end of the cable is connected to your router, the other to an Direct Connect router.

To find the locations for your Region, use DescribeLocations.

You can automatically add the new connection to a link aggregation group (LAG) by specifying a LAG ID in the request. This ensures that the new connection is allocated on the same Direct Connect endpoint that hosts the specified LAG. If there are no available ports on the endpoint, the request fails and no connection is created.

Parameters:

  • location (LocationCode) –

    The location of the connection.

  • bandwidth (Bandwidth) –

    The bandwidth of the connection.

  • connection_name (ConnectionName) –

    The name of the connection.

  • lag_id (Optional[LagId], default: None ) –

    The ID of the LAG.

  • tags (Optional[TagList], default: None ) –

    The tags to associate with the lag.

  • provider_name (Optional[ProviderName], default: None ) –

    The name of the service provider associated with the requested connection.

  • request_mac_sec (Optional[RequestMACSec], default: None ) –

    Indicates whether you want the connection to support MAC Security (MACsec).

    MAC Security (MACsec) is unavailable on hosted connections. For information about MAC Security (MACsec) prerequisites, see MAC Security in Direct Connect in the Direct Connect User Guide.

  • billing_mode (Optional[RequestBillingMode], default: None ) –

    The billing mode for the connection.

Raises:

Source code in docs_src/capo_direct_connect/_services/direct_connect.py
def create_connection(
    self,
    location: "capo_direct_connect.types.location_code.LocationCode",
    bandwidth: "capo_direct_connect.types.bandwidth.Bandwidth",
    connection_name: "capo_direct_connect.types.connection_name.ConnectionName",
    *,
    config_overrides: Optional[DirectConnectClientConfig] = None,
    lag_id: Optional["capo_direct_connect.types.lag_id.LagId"] = None,
    tags: Optional["capo_direct_connect.types.tag_list.TagList"] = None,
    provider_name: Optional[
        "capo_direct_connect.types.provider_name.ProviderName"
    ] = None,
    request_mac_sec: Optional[
        "capo_direct_connect.types.request_mac_sec.RequestMACSec"
    ] = None,
    billing_mode: Optional[
        "capo_direct_connect.types.request_billing_mode.RequestBillingMode"
    ] = None,
) -> "capo_direct_connect.types.connection.Connection":
    """<p>Creates a connection between a customer network and a specific Direct Connect location.</p> <p>A connection links your internal network to an Direct Connect location over a standard Ethernet fiber-optic cable. One end of the cable is connected to your router, the other to an Direct Connect router.</p> <p>To find the locations for your Region, use <a>DescribeLocations</a>.</p> <p>You can automatically add the new connection to a link aggregation group (LAG) by specifying a LAG ID in the request. This ensures that the new connection is allocated on the same Direct Connect endpoint that hosts the specified LAG. If there are no available ports on the endpoint, the request fails and no connection is created.</p>

    Args:
        location: <p>The location of the connection.</p>
        bandwidth: <p>The bandwidth of the connection.</p>
        connection_name: <p>The name of the connection.</p>
        lag_id: <p>The ID of the LAG.</p>
        tags: <p>The tags to associate with the lag.</p>
        provider_name: <p>The name of the service provider associated with the requested connection.</p>
        request_mac_sec: <p>Indicates whether you want the connection to support MAC Security (MACsec).</p> <p>MAC Security (MACsec) is unavailable on hosted connections. For information about MAC Security (MACsec) prerequisites, see <a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/MACSec.html">MAC Security in Direct Connect</a> in the <i>Direct Connect User Guide</i>.</p>
        billing_mode: <p>The billing mode for the connection.</p>

    Raises:
        capo_direct_connect.errors.direct_connect_client_exception.DirectConnectClientException: <p>One or more parameters are not valid.</p>
        capo_direct_connect.errors.direct_connect_server_exception.DirectConnectServerException: <p>A server-side error occurred.</p>
        capo_direct_connect.errors.duplicate_tag_keys_exception.DuplicateTagKeysException: <p>A tag key was specified more than once.</p>
        capo_direct_connect.errors.too_many_tags_exception.TooManyTagsException: <p>You have reached the limit on the number of tags that can be assigned.</p>
        capo_direct_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_direct_connect.types.create_connection_request.CreateConnectionRequest]",
    ) -> OperationResponse["capo_direct_connect.types.connection.Connection"]:
        import capo_direct_connect._operations.overture_service.create_connection

        output, http_response = (
            capo_direct_connect._operations.overture_service.create_connection.create_connection(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateConnection")
    )
    input_: capo_direct_connect.types.create_connection_request.CreateConnectionRequest = {
        "location": location,
        "bandwidth": bandwidth,
        "connection_name": connection_name,
    }
    if lag_id is not None:
        input_["lag_id"] = lag_id
    if tags is not None:
        input_["tags"] = tags
    if provider_name is not None:
        input_["provider_name"] = provider_name
    if request_mac_sec is not None:
        input_["request_mac_sec"] = request_mac_sec
    if billing_mode is not None:
        input_["billing_mode"] = billing_mode

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output