Skip to content

delete_vpn_connection async

delete_vpn_connection(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    vpn_connection_id: Optional[VpnConnectionId] = None,
    dry_run: Optional[Boolean] = None,
) -> None

Deletes the specified VPN connection.

If you're deleting the VPC and its associated components, we recommend that you detach the virtual private gateway from the VPC and delete the VPC before deleting the VPN connection. If you believe that the tunnel credentials for your VPN connection have been compromised, you can delete the VPN connection and create a new one that has new keys, without needing to delete the VPC or virtual private gateway. If you create a new VPN connection, you must reconfigure the customer gateway device using the new configuration information returned with the new VPN connection ID.

For certificate-based authentication, delete all Certificate Manager (ACM) private certificates used for the Amazon Web Services-side tunnel endpoints for the VPN connection before deleting the VPN connection.

Parameters:

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

    The ID of the VPN connection.

  • 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.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def delete_vpn_connection(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    vpn_connection_id: Optional[
        "capo_ec2.types.vpn_connection_id.VpnConnectionId"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> None:
    """<p>Deletes the specified VPN connection.</p> <p>If you're deleting the VPC and its associated components, we recommend that you detach the virtual private gateway from the VPC and delete the VPC before deleting the VPN connection. If you believe that the tunnel credentials for your VPN connection have been compromised, you can delete the VPN connection and create a new one that has new keys, without needing to delete the VPC or virtual private gateway. If you create a new VPN connection, you must reconfigure the customer gateway device using the new configuration information returned with the new VPN connection ID.</p> <p>For certificate-based authentication, delete all Certificate Manager (ACM) private certificates used for the Amazon Web Services-side tunnel endpoints for the VPN connection before deleting the VPN connection.</p>

    Args:
        vpn_connection_id: <p>The ID of the VPN connection.</p>
        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>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.delete_vpn_connection_request.DeleteVpnConnectionRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.delete_vpn_connection

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteVpnConnection")
    )
    input_: capo_ec2.types.delete_vpn_connection_request.DeleteVpnConnectionRequest = {}
    if vpn_connection_id is not None:
        input_["vpn_connection_id"] = vpn_connection_id
    if dry_run is not None:
        input_["dry_run"] = dry_run

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