IBM Cloud Docs
Deleting a route

Deleting a route

You can delete a route for an IBM Cloud service by using the console, CLI, API, or Terraform.

Deleting a route in the console

To delete a route in the console, follow these steps:

  1. From the IBM Cloud console, select the Navigation Menu Navigation menu, then click Infrastructure > Network > Routing tables. The Routing tables for VPC page appears.
  2. Click the number of routes, or the routing table name that contains the route.
  3. Click the Actions menu Actions menu next to the route that you want to delete, then click Delete. Click Delete again to confirm the deletion.

Deleting a route from the CLI

Before you begin, set up your CLI environment.

To delete a route from the CLI, run the following command:

ibmcloud is vpc-routing-table-route-delete VPC ROUTING_TABLE ROUTE [-f, --force]

Where:

VPC
Is the ID or name of the VPC.
ROUTING_TABLE
Is the ID or name of the VPC routing table.
ROUTE
Is the ID or name of the VPC route.
-f, --force
Forces the operation without confirmation.

Deleting a route with the API

To delete a route with the API, follow these steps:

  1. Set up your API environment.

  2. Store the following values in variables to be used in the API command:

    export VpcId=<your_vpc_id>
    export RoutingTableId=<your_routing_table_id>
    export RouteId=<your_route_id>
    
  3. Delete a route:

    curl -X DELETE "$vpc_api_endpoint/v1/vpcs/$VpcId/routing_tables/$RoutingTableId/routes/$RouteId?version=$api_version&generation=2" \
       -H "Authorization: $iam_token"
    

Deleting a route with Terraform

To delete a route with Terraform, follow these steps:

  1. Set up your Terraform environment.

  2. Delete a route:

    terraform destroy --target="ibm_is_vpc_routing_table_route.example"
    

    For more information about the terraform destroy command, see the Terraform Registry.