VM metadata
Note
You can get direct access (without authentication) to metadata through a special metadata service available inside the VM instance using the following URL: http://169.254.169.254
. The metadata service inside the VM instance is available to all VM instances regardless of their network settings and internet access.
VM instance metadata is metadata (additional data) about the VM instance.
The VM instance metadata service stores metadata in folders as key-value
pairs.
You can use metadata:
- To enable the cloud-init
process when creating a VM instance. - To provide the required information in the
user-data
key to services or applications run on the VM instance after it is created. - To get data from inside the VM instance required for authentication in Yandex Cloud.
The VM instance ID, Cloud Marketplace image ID, and a number of other metadata values together form a unique identity document of the VM instance.
VM instance metadata service parameters
In Yandex Cloud, you can access VM instance metadata in Google Compute EngineMetadata-Flavor:Google
HTTP header when accessing the metadata service.
Compute Cloud VMs support the following VM metadata service settings:
gce-http-endpoint
: Provides access to metadata using the Google Compute Engine format. It can be eitherenabled
ordisabled
. If set todisabled
, the metadata request will fail with error400
(BadRequest
). The default value isenabled
.gce-http-token
: Enables using Google Compute Engine metadata to get the IAM token for the service account connected to the VM. It can be eitherenabled
ordisabled
. If set todisabled
, the token request will fail with error400
(BadRequest
). The default value isenabled
.
You can get the current VM instance metadata service parameters together with the VM information using the CLI and API.
You can configure the metadata service when creating or updating VMs. For more information on how to configure the metadata service, see this guide.