Keys processed in public images Yandex Cloud
The list of keys processed by the metadata service in Yandex Cloud public images depends on the image OS:
-
serial-port-enable: Key responsible for access to serial console of the VM instance: The possible values are:0: Access to serial console disabled. Default value.1: Access to serial console enabled.
-
enable-oslogin: Key responsible for access to the VM instance via OS Login. The possible values are:false: Access via OS Login disabled. Default value.true: Access via OS Login enabled.
-
user-data: Key containing a string with the user metadata that will be processed by the cloud-init agent running on the VM instance.Cloud-init supports different metadata transmission formats
, e.g., cloud-config . In this format, you can provide SSH keys and indicate which user each key is associated with. To do this, specify them in theusers/ssh_authorized_keyssection:#cloud-config users: - name: <username> groups: sudo shell: /bin/bash sudo: 'ALL=(ALL) NOPASSWD:ALL' ssh_authorized_keys: - <public_SSH_key_1> - <public_SSH_key_2> - ...Where:
-
name: VM user name. -
ssh_authorized_keys: List of public SSH keys for VM access.Key example:
ssh-ed25519 AAAAB3Nza...Pu00jRN.
To provide this data in the request, replace line breaks with
\n:"metadata": { "user-data": "#cloud-config\nusers:\n - name: user\n groups: sudo\n shell: /bin/bash\n sudo: 'ALL=(ALL) NOPASSWD:ALL'\n ssh_authorized_keys:\n - ssh-ed25519 AAAAB3Nza......OjbSMRX user@example.com\n - ssh-ed25519 AAAAB3Nza...Pu00jRN" }In the
user-datakey, you may also describe the software installation scripts you want executed when creating a new VM instance and provide to the VM instance the Yandex Lockbox secrets and variables whose values you can later get from within the VM instance. -
-
ssh-keys: Key responsible for delivering a public SSH key to the Linux VM instance via Terraform. Use this format:<username>:<SSH_key_contents>, e.g.,user:ssh-ed25519 AAAAB3Nza...Pu00jRN. If you specify multiple keys, only the first one will be used.
user-data: Key containing a string with user metadata to be processed by the Cloudbase-Init
"metadata": {
"user-data": "#ps1\nnet user Administrator Passw0rd"
}
Use cases
- Deploying Remote Desktop Gateway
- Creating a VM and an instance group from a Container Optimized Image using Terraform
- Associating a Yandex Cloud Backup policy to a VM automatically
- Connecting resources from different folders
- Running a Docker image on a VM