| copyright |
|
||
|---|---|---|---|
| lastupdated | 2026-02-20 | ||
| keywords | direct link | ||
| subcollection | dl |
{{site.data.keyword.attribute-definition-list}}
{: #delete-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. {: shortdesc}
{: #before-you-begin-delete-direct-link}
Ensure that the direct link is in a stable state suitable for deletion. In review,In progress, or similar transient states cannot be deleted.
{: #delete-direct-link-console} {: ui}
To delete a direct link in the {{site.data.keyword.cloud_notm}} console{: external}, follow these steps:
-
Detach all virtual connections:
-
Delete the direct link:
{: #delete-direct-link-cli} {: 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
{: pre}
-
Delete each virtual connection:
ibmcloud dl virtual-connection-delete VIRTUAL_CONNECTION_ID
{: pre}
Repeat for all virtual connections.
-
Delete the direct link:
ibmcloud dl gateway-delete GATEWAY_ID --force
{: pre}
{: #delete-direct-link-api} {: 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"
{: pre}
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"{: pre}
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"
{: pre}
{: #python-example} {: api}
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){: codeblock}
For more information, including Java, Node, and Go examples, see "Delete gateway" in the Direct Link API reference. {: note}
{: #delete-direct-link-terraform} {: 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{: pre}
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. {: note}