Deleting a cloud network
Alert
Before deleting a network, you need to delete all its child resources.
You cannot restore a network after it is deleted.
To delete a cloud network:
- In the management console
, select the folder where you need to delete a cloud network. - Go to Virtual Private Cloud.
- Click
in the row of the network you need and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
View the description of the CLI command for deleting cloud networks:
yc vpc network delete --help -
Get a list of all networks in the default folder:
yc vpc network listResult:
+----------------------+----------------+ | ID | NAME | +----------------------+----------------+ | enpiuvhhd4t8******** | test-network-1 | | enplom7a98s1******** | default | +----------------------+----------------+ -
Select the network
IDorNAME. -
Delete the network:
yc vpc network delete test-network-1
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
To delete a cloud network created with Terraform:
-
Open the Terraform configuration file and delete the fragment with the cloud network description.
Example of a cloud network description in the Terraform configuration
... resource "yandex_vpc_network" "default" { name = "network-1" description = "My first network" labels = { tf-label = "tf-label-value" empty-label = "" } } ... -
In the command line, navigate to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm changes.You can check the update using the management console
or these CLI commands:yc vpc network list
To delete a cloud network, use the delete REST API method for the Network resource or the NetworkService/Delete gRPC API call, and provide the ID of the cloud network to delete in the networkId request parameter.
To get the cloud network ID, use the list REST API method for the Network resource or the NetworkService/List gRPC API call and provide the folder ID in the folderId request parameter.
To learn how to find out the folder ID, see Getting the folder ID.