Deleting a direct link
IBM Cloud Direct Link gateways provide private, high-speed connections between on-premises networks or colocation facilities and IBM Cloud. Proper deletion ensures resources are cleaned up, virtual connections are detached, and billing stops. This topic explains how to remove a direct link for all major offerings: Direct Link Connect, Direct Link Dedicated, and Dedicated Hosting.
Before you begin
Ensure that the direct link is in a stable state suitable for deletion. In review,In progress, or similar transient states cannot be deleted.
Deleting a direct link in the console
To delete a direct link in the IBM Cloud console, follow these steps:
-
Detach all virtual connections:
- Select the Navigation menu
, then click Infrastructure
> Network > Direct link.
- In the list, select the direct link to open its Details page.
- In the Virtual connections section, click the
icon next to each virtual connecton.
- Confirm the deletion for each virtual connection when prompted.
- Select the Navigation menu
-
Delete the direct link:
- Go back to the Direct Link list page.
- Locate the direct link that you want to delete.
- Click Delete from the Actions
menu.
- Confirm the deletion.
Deleting a direct link from the CLI
To delete a direct link and its associated virtual connections from the CLI, follow these steps:
-
List all virtual connections:
ibmcloud dl vc-list --gateway-id GATEWAY_ID -
Delete each virtual connection:
ibmcloud dl virtual-connection-delete VIRTUAL_CONNECTION_IDRepeat for all virtual connections.
-
Delete the direct link:
ibmcloud dl gateway-delete GATEWAY_ID --force
Deleting a direct link with the API
Before deleting a direct link, you must first remove all virtual connections attached to the gateway. If virtual connections remain, the gateway delete call fails with an error indicating that they must be removed first.
To delete a direct link with the API, follow these steps:
-
List all virtual connections for the gateway:
curl -X GET \ "https://directlink.cloud.ibm.com/v1/gateways/$GATEWAY_ID/virtual_connections?version=2019-12-13" \ -H "Authorization: Bearer $IAM_TOKEN"This returns the virtual connections associated with the gateway.
-
Delete each virtual connection:
curl -X DELETE \ "https://directlink.cloud.ibm.com/v1/gateways/$GATEWAY_ID/virtual_connections/$VC_ID?version=2019-12-13" \ -H "Authorization: Bearer $IAM_TOKEN"Repeat this call for each virtual connection ID returned by the list call. The API deletes each specified virtual connection.
-
After all virtual connections have been removed, delete the direct link:
curl -X DELETE \ "https://directlink.cloud.ibm.com/v1/gateways/$GATEWAY_ID?version=2019-12-13" \ -H "Authorization: Bearer $IAM_TOKEN"
Python example
from ibm_cloud_networking_services import DirectLinkV1
direct_link = DirectLinkV1(authenticator=auth)
# List and delete all virtual connections
vc_list = direct_link.list_gateway_virtual_connections(gateway_id=gateway_id).get_result()
for vc in vc_list.get("virtual_connections", []):
direct_link.delete_gateway_virtual_connection(gateway_id=gateway_id, id=vc["id"])
# Delete the gateway
direct_link.delete_gateway(id=gateway_id)
For more information, including Java, Node, and Go examples, see "Delete gateway" in the Direct Link API reference.
Deleting a direct link with Terraform
If using Terraform, destroy virtual connections first, then the gateway:
terraform destroy -target=ibm_dl_virtual_connection.vc_example
terraform destroy -target=ibm_dl_gateway.gateway_example
Deleting the gateway before virtual connections can fail due to dependencies.
Offering-specific tasks
Here are additional steps to follow depending on the type of direct link that you are deleting.
- For Direct Link Connect, remove the corresponding connection in the provider portal.
- For Direct Link Dedicated, put in a delete request for your cross-connects with your provider.
- For Direct Link Dedicated Hosting, coordination with the hosting provider is required to de-provision the physical infrastructure and complete contract closure.
Billing stops after the direct link and associated virtual connections are removed.