Skip to content

create_bgp_peer

create_bgp_peer(
    *,
    config_overrides: Optional[DirectConnectClientConfig] = None,
    virtual_interface_id: Optional[VirtualInterfaceId] = None,
    new_bgp_peer: Optional[NewBGPPeer] = None,
) -> CreateBGPPeerResponse

Creates a BGP peer on the specified virtual interface.

You must create a BGP peer for the corresponding address family (IPv4/IPv6) in order to access Amazon Web Services resources that also use that address family.

If logical redundancy is not supported by the connection, interconnect, or LAG, the BGP peer cannot be in the same address family as an existing BGP peer on the virtual interface.

When creating a IPv6 BGP peer, omit the Amazon address and customer address. IPv6 addresses are automatically assigned from the Amazon pool of IPv6 addresses; you cannot specify custom IPv6 addresses.

If you let Amazon Web Services auto-assign IPv4 addresses, a /30 CIDR will be allocated from 169.254.0.0/16. Amazon Web Services does not recommend this option if you intend to use the customer router peer IP address as the source and destination for traffic. Instead you should use RFC 1918 or other addressing, and specify the address yourself. For more information about RFC 1918 see Address Allocation for Private Internets.

For a public virtual interface, the Autonomous System Number (ASN) must be private or already on the allow list for the virtual interface.

Parameters:

Raises:

Source code in docs_src/capo_direct_connect/_services/direct_connect.py
def create_bgp_peer(
    self,
    *,
    config_overrides: Optional[DirectConnectClientConfig] = None,
    virtual_interface_id: Optional[
        "capo_direct_connect.types.virtual_interface_id.VirtualInterfaceId"
    ] = None,
    new_bgp_peer: Optional[
        "capo_direct_connect.types.new_bgp_peer.NewBGPPeer"
    ] = None,
) -> "capo_direct_connect.types.create_bgp_peer_response.CreateBGPPeerResponse":
    """<p>Creates a BGP peer on the specified virtual interface.</p> <p>You must create a BGP peer for the corresponding address family (IPv4/IPv6) in order to access Amazon Web Services resources that also use that address family.</p> <p>If logical redundancy is not supported by the connection, interconnect, or LAG, the BGP peer cannot be in the same address family as an existing BGP peer on the virtual interface.</p> <p>When creating a IPv6 BGP peer, omit the Amazon address and customer address. IPv6 addresses are automatically assigned from the Amazon pool of IPv6 addresses; you cannot specify custom IPv6 addresses.</p> <important> <p>If you let Amazon Web Services auto-assign IPv4 addresses, a /30 CIDR will be allocated from 169.254.0.0/16. Amazon Web Services does not recommend this option if you intend to use the customer router peer IP address as the source and destination for traffic. Instead you should use RFC 1918 or other addressing, and specify the address yourself. For more information about RFC 1918 see <a href="https://datatracker.ietf.org/doc/html/rfc1918"> Address Allocation for Private Internets</a>.</p> </important> <p>For a public virtual interface, the Autonomous System Number (ASN) must be private or already on the allow list for the virtual interface.</p>

    Args:
        virtual_interface_id: <p>The ID of the virtual interface.</p>
        new_bgp_peer: <p>Information about the BGP peer.</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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_direct_connect.types.create_bgp_peer_request.CreateBGPPeerRequest]",
    ) -> OperationResponse[
        "capo_direct_connect.types.create_bgp_peer_response.CreateBGPPeerResponse"
    ]:
        import capo_direct_connect._operations.overture_service.create_bgp_peer

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBGPPeer")
    )
    input_: capo_direct_connect.types.create_bgp_peer_request.CreateBGPPeerRequest = {}
    if virtual_interface_id is not None:
        input_["virtual_interface_id"] = virtual_interface_id
    if new_bgp_peer is not None:
        input_["new_bgp_peer"] = new_bgp_peer

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