Deleting a subnet
Alert
Before deleting a subnet, disable all resources connected to it.
You cannot restore a subnet after it is deleted.
Management console
CLI
To delete a subnet:
- Open the Virtual Private Cloud section in the folder you want to delete the subnet from.
- Click on the name of the subnet's cloud network.
- Click in the row of the subnet to delete.
- In the menu that opens, click Delete.
- In the window that opens, click Delete.
If you don't 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 command for deleting a subnet:
$ yc vpc subnet delete --help
-
Get a list of all subnets in the default folder:
$ yc vpc subnet list +----------------------+-----------------------+------------------------+ | ID | NAME | ... | RANGE | +----------------------+-----------------------+------------------------+ ... | e2l0psbfoloefpjb1rau | test-subnet-1 | ... | [192.168.0.0/24] | ... +----------------------+-----------------------+-----+------------------+
-
Select the
ID
orNAME
of the subnet you need. -
Delete the subnet from the default folder:
$ yc vpc subnet delete test-subnet-1
Examples
Deleting a subnet from a particular folder
CLI
To delete a subnet from a different folder, use the --folder-id
or --folder-name
flag.
$ yc vpc subnet delete test-subnet-2 --folder-id b1gnbfd11bq5g5vnjgr4
$ yc vpc subnet delete test-subnet-2 --folder-name test-folder
You can pass the ID and name as positional arguments, or you can use the --id
and --name
flags:
$ yc vpc subnet delete --id enpavfmgapumnl7cqin8
$ yc vpc subnet delete --name test-network-1