Deleting a subnet


Before deleting a subnet, disable all resources connected to it. You cannot restore a subnet after it is deleted.

To delete a subnet:

  1. Open the Virtual Private Cloud section in the folder you want to delete the subnet from.
  2. Click on the name of the subnet's cloud network.
  3. Click vertical-ellipsis in the row of the subnet to delete.
  4. In the menu that opens, click Delete.
  5. In the window that opens, click Delete.

If you don't have the Yandex.Cloud command line interface yet, install 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.

  1. See the description of the CLI command for deleting a subnet:

    $ yc vpc subnet delete --help
  2. Get a list of all subnets in the default folder:

    $ yc vpc subnet list
    |          ID          |         NAME          | ... |       RANGE      |
    | e2l0psbfoloefpjb1rau | test-subnet-1         | ... | [] |
  3. Select the ID or NAME of the subnet you need.

  4. Delete the subnet from the default folder:

    $ yc vpc subnet delete test-subnet-1


Deleting a subnet from a particular folder

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