Deleting a VCN
Delete a Virtual Cloud Network (VCN) from OCI.
The Console has an easy "Delete all" process that scans the chosen compartments then deletes a VCN and its related Networking resources (subnets, route tables, security lists, sets of DHCP options, internet gateway, and so on). If the VCN is attached to a Dynamic Routing Gateway (DRG), the process deletes the attachment, but the DRG remains.
The "Delete All" process deletes one resource at a time. A VCN with many compartments and resources takes longer to delete than a VCN with only a few. A progress report is displayed to show the results of both the scan for resources and the deletion of those resources.
Before using the "Delete All" process, verify that no resources such as compute instances, load balancers, OCI database systems, or orphaned mount targets are present in any of the subnets. If any of these are present, the deletion process stalls when trying to delete the resource's subnet. Deleted VCN resources are irretrievable. For more information, see Subnet or VCN Deletion.
If any subnet still contains resources, or if you don't have permission to delete a particular Networking resource, the "Delete All" process stops and returns an error message that includes the OCIDs of the blocking resources and subnets, which link to the details page for that resource. In some cases, you might need to contact your tenancy administrator to help you delete any remaining resources if you don't have the needed permissions.
If the VCN is empty, its state changes to TERMINATING and then TERMINATED temporarily until the VCN is completely removed. Once a deleted VCN is completely removed it no longer appears in the list of VCNs in that compartment. Use the network vcn delete command and required parameters to delete a VCN:
oci network vcn delete --vcn-id vcn-ocid ... [OPTIONS]
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the DeleteVcn operation to delete a VCN.
Be aware this deletes only the VCN and not its related resources. If there are any resources in the VCN, the deletion attempt will not succeed. For more information, see Subnet or VCN Deletion. The Console offers a "Delete All" process that makes it easy to delete the VCN and its related resources.