Deleting a Subnet

Delete a subnet from a Virtual Cloud Network (VCN).

Before you can delete a subnet, it must have no instances, load balancers, OCI database systems, or orphaned mount targets in it. For more information, see Subnet or VCN Deletion.

If the subnet is empty, its state changes to TERMINATING briefly and then TERMINATED. If the subnet is not empty, you get an error indicating that there are still instances or other resources in it that you must delete first.

    1. On the VCN list page, select the VCN that contains the subnet you want to work with. This takes you to the VCN's details page.
    2. On the details page, perform one of the following actions depending on the option that you see:
      • Select the Subnets tab.
      • Scroll down to the table following the VCN details, which lists the subnets in the VCN.
    3. From the Actions menu Actions Menu for the subnet you want to delete, select Terminate.
    4. When prompted, confirm the deletion.
  • Use the network subnet delete command and required parameters to delete a subnet:

    oci network subnet delete --subnet-id ocid ... [OPTIONS]

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the DeleteSubnet operation to delete a subnet.