Updating a subnet
After creating a subnet, you can change its name, description, and tags.
CLI
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 updating subnet parameters:
$ yc vpc subnet update --help
-
Get a list of all subnets in the default folder:
$ yc vpc subnet list +----------------------+-----------------------+----------------------+ | ID | NAME | ... | +----------------------+-----------------------+----------------------+ ... | e2l2prrbkbimvjuuhht2 | test-subnet-1 | ... | ... +----------------------+-----------------------+----------------------+
-
Select the
ID
orNAME
of the subnet you need. -
Change the subnet parameters, for example:
$ yc vpc subnet update e2l2prrbkbimvjuuhht2 \ --new-name test-subnet-renamed \ --labels new_label=test_label id: e2l2prrbkbimvjuuhht2 folder_id: b1g6ci08ma55klukmdjs created_at: "2018-10-24T13:54:10Z" name: test-subnet-renamed description: My test subnet labels: new_label: test_label network_id: enplom7a98s1t0lhass8 zone_id: ru-central1-b v4_cidr_blocks: - 192.168.0.0/24
Examples
Changing a subnet using the name flag
CLI
You can change a subnet by using its name instead of its ID:
$ yc vpc subnet update test-subnet-1 \
--new-name test-subnet-renamed \
--labels new_label=test_label
id: e2l2prrbkbimvjuuhht2
folder_id: b1g6ci08ma55klukmdjs
created_at: "2018-10-24T13:54:10Z"
name: test-subnet-renamed
description: My test subnet
labels:
new_label: test_label
network_id: enplom7a98s1t0lhass8
zone_id: ru-central1-b
v4_cidr_blocks:
- 192.168.0.0/24
You can pass the subnet ID and name as positional arguments, or you can use the --id
and --name
flags:
$ yc vpc network update --id enpavfmgapumnl7cqin8 \
--new-name test-network-renamed \
--labels new_label=test_label
$ yc vpc network update --name test-network-1 \
--new-name test-network-renamed \
--labels new_label=test_label