Updating a VM
After you create a VM, you can change its name, description, tags, platform, or metadata.
For more information about how to update a VM configuration, see Changing VM computing resources.
To update a VM:
- Open the folder that the VM belongs to.
- Select Yandex Compute Cloud.
- Click on the VM name.
- Click Edit VM.
- Change the VM parameters, for example, rename it by editing the Name field.
- At the bottom of the page, click Save changes.
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's update VM parameter command:
$ yc compute instance update --help
-
Get a list of VMs in the default folder:
$ yc compute instance list +----------------------+-----------------+---------------+---------+----------------------+ | ID | NAME | ZONE ID | STATUS | DESCRIPTION | +----------------------+-----------------+---------------+---------+----------------------+ | fhm0b28lgfp4tkoa3jl6 | first-instance | ru-central1-a | RUNNING | my first vm via CLI | | fhm9gk85nj7gcoji2f8s | second-instance | ru-central1-a | RUNNING | my second vm via CLI | +----------------------+-----------------+---------------+---------+----------------------+
-
Select the VM
ID
orNAME
(for example,first-instance
). -
Change the VM parameters, for example, rename it:
$ yc compute instance update first-instance \ --new-name windows-vm
Note
If you change the VM name, the host name and FQDN are not changed. For more information about generating the FQDN, see Hostname and FQDN.
Examples
Viewing a list of configurable parameters
To view the list of configurable parameters, run the command:
$ yc compute instance update --help
Changing the name and description
To change the name and description of a VM, follow these steps:
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.
-
Get a list of VMs in the default folder:
$ yc compute instance list +----------------------+-----------------+---------------+---------+----------------------+ | ID | NAME | ZONE ID | STATUS | DESCRIPTION | +----------------------+-----------------+---------------+---------+----------------------+ | fhm0b28lgfp4tkoa3jl6 | first-instance | ru-central1-a | RUNNING | my first vm via CLI | | fhm9gk85nj7gcoji2f8s | second-instance | ru-central1-a | RUNNING | my second vm via CLI | +----------------------+-----------------+---------------+---------+----------------------+
-
Select the VM
ID
orNAME
(for example,first-instance
). -
Change the VM's name and description:
$ yc compute instance update first-instance \ --new-name first-vm \ --description "changed description vm via CLI"
Changing metadata
Metadata based on different operating systems may differ. When you change an existing set of metadata, it is completely replaced by the set passed in the command.
To change a VM's metadata, follow these steps:
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.
-
Get a list of VMs in the default folder:
$ yc compute instance list +----------------------+-----------------+---------------+---------+----------------------+ | ID | NAME | ZONE ID | STATUS | DESCRIPTION | +----------------------+-----------------+---------------+---------+----------------------+ | fhm0b28lgfp4tkoa3jl6 | first-instance | ru-central1-a | RUNNING | my first vm via CLI | | fhm9gk85nj7gcoji2f8s | second-instance | ru-central1-a | RUNNING | my second vm via CLI | +----------------------+-----------------+---------------+---------+----------------------+
-
Select the VM
ID
orNAME
(for example,first-instance
). -
Get information about the VM with the metadata. All user-defined metadata is specified in the
user-data
key.$ yc compute instance get --full first-instance
-
Change the VM's metadata. You can change the metadata using the flags:
--metadata
— to change a value from a single string.--metadata-from-file
— to change a value from multiple strings.
Example of changing the administrator password on a Windows-based VM:
-
Create a YAML file (for example,
metadata.yaml
) and specify the following:#ps1 net user administrator "<password>"
-
Run the command:
$ yc compute instance update first-instance \ --metadata-from-file user-data=metadata.yaml
The existing metadata set will be completely overwritten.