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
, go to the folder where you need to delete a cloud network. - In the list of services, select Virtual Private Cloud.
- Click
next to the network and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI's delete cloud network command:
yc vpc network delete --help
-
Get a list of all networks in the default folder:
yc vpc network list
Result:
+----------------------+----------------+ | ID | NAME | +----------------------+----------------+ | enpiuvhhd4t8******** | test-network-1 | | enplom7a98s1******** | default | +----------------------+----------------+
-
Select the network's
ID
orNAME
. -
Delete the network:
yc vpc network delete test-network-1
If you don't have Terraform, 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 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 cloud network description in a 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, go to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can check the update using the management console
or this CLI command: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 be deleted, 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.