Skip to content

create_vpn_connection_route

create_vpn_connection_route(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    destination_cidr_block: Optional[String] = None,
    vpn_connection_id: Optional[VpnConnectionId] = None,
) -> None

Creates a static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.

For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.

Parameters:

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

    The CIDR block associated with the local subnet of the customer network.

  • vpn_connection_id (Optional[VpnConnectionId], default: None ) –

    The ID of the VPN connection.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def create_vpn_connection_route(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    destination_cidr_block: Optional["capo_ec2.types.string.String"] = None,
    vpn_connection_id: Optional[
        "capo_ec2.types.vpn_connection_id.VpnConnectionId"
    ] = None,
) -> None:
    """<p>Creates a static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html">Amazon Web Services Site-to-Site VPN</a> in the <i>Amazon Web Services Site-to-Site VPN User Guide</i>.</p>

    Args:
        destination_cidr_block: <p>The CIDR block associated with the local subnet of the customer network.</p>
        vpn_connection_id: <p>The ID of the VPN connection.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.create_vpn_connection_route_request.CreateVpnConnectionRouteRequest]",
    ) -> OperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.create_vpn_connection_route

        output, http_response = (
            capo_ec2._operations.amazon_ec2.create_vpn_connection_route.create_vpn_connection_route(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVpnConnectionRoute")
    )
    input_: capo_ec2.types.create_vpn_connection_route_request.CreateVpnConnectionRouteRequest = {}
    if destination_cidr_block is not None:
        input_["destination_cidr_block"] = destination_cidr_block
    if vpn_connection_id is not None:
        input_["vpn_connection_id"] = vpn_connection_id

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