Compute Engine defines a set of default metadata entries that provide information about your virtual machine (VM) instance or project. Default metadata is always defined and set by the server. Default metadata keys are case sensitive.
For information about querying metadata values, see Querying VM metadata.
How metadata values are arranged
Project and instance metadata: Metadata can be assigned to both projects and VMs. Project metadata propagates to all VMs within a project, while instance metadata only applies to a single VM.
Directory listings: Some metadata entries are directories that contain other metadata keys. This difference is marked by a trailing slash in the metadata name. For example,
attributes/
is a directory that contains other metadata keys.
Project metadata
Project metadata entries are stored under the following directory:
http://metadata.google.internal/computeMetadata/v1/project/
Metadata entry | Description |
---|---|
attributes/ |
A directory of custom metadata values passed to the VMs in your project during startup or shutdown. These custom values can either be Google Cloud attributes or user-created metadata values. For a list of project-level Google Cloud attributes that you can set, see Project attributes. For more information about setting custom metadata, see Setting VM metadata. |
numeric-project-id |
The numeric project ID (project number)
of the instance, which is not the same as the
project name that is visible in the Google Cloud console. This value
is different from the project-id metadata entry value.
|
project-id |
The project ID. |
Project attributes
The project attributes are stored under the following directory:
http://metadata.google.internal/computeMetadata/v1/project/attributes/
Metadata entry | Description |
---|---|
disable-legacy-endpoints |
Disables legacy metadata server endpoints for all VMs in your project. Legacy endpoints are deprecated, always set
|
enable-guest-attributes |
Sets guest attributes for the project. Guest attributes are custom VM instance metadata values that you can use to publish infrequent status notifications, low volume data, or low frequency data. These values are useful for indicating when startup scripts have finished or for providing other infrequent status notifications to other applications. For more information about guest attributes, see Setting and querying guest attributes. |
enable-os-inventory |
Enables or disables OS inventory for the project. Collects and stores OS details information. This includes information such as hostname, kernel version, architecture, and installed packages details. For more information about OS inventory, see Viewing operating system details. |
enable-oslogin |
Enables or disables SSH key management on your project. For more information about OS Login, see Setting up OS Login. |
google-compute-default-region |
If set, stores the default region that is used by the project.
For more information about setting default regions, see Default region and zone. |
google-compute-default-zone |
If set, stores the default zone that is used by the project.
For more information about setting default zones, see Default region and zone. |
ssh-keys |
If you are
managing SSH keys using metadata,
this attribute lets you configure public SSH keys that can connect to VMs
in this project. If there are multiple SSH keys, each key is separated by
a newline character (
Example: SSH keys managed by OS Login aren't visible in metadata. |
sshKeys |
Deprecated: Use ssh-keys .
|
vmdnssetting |
Enable zonal DNS and global DNS for the VMs in your project. For more information about internal DNS names, see Configuring DNS names. |
VM instance metadata
The VM metadata entries are stored under the following directory:
http://metadata.google.internal/computeMetadata/v1/instance/
Metadata entry | Description |
---|---|
attributes/ |
A directory of custom metadata values passed to the VM during startup or shutdown. These custom values can either be Google Cloud attributes or user-created metadata values. For a list of instance-level Google Cloud attributes that you can set, see Instance attributes For more information about setting custom metadata, see Setting custom metadata. |
cpu-platform |
CPU platform of the VM. For information about CPU platforms, see CPU platforms. |
description |
The free-text description of an instance that is assigned using the
--description flag by using the Google Cloud CLI or the API.
|
disks/ |
A directory of disks that are attached to the VM. For each disk, the following information is available:
For more information about disks, see Storage options. |
guest-attributes/ |
Sets guest attributes for the VM. These custom values can either be Google Cloud attributes or user-created metadata values. For a list of instance-level Google Cloud attributes that you can set, see Instance guest attributes For more information about guest attributes, see Setting and querying guest attributes. |
hostname |
The hostname of the VM. |
id |
The ID of the VM. This is a unique, numerical ID that is generated by Compute Engine. This is useful for identifying VMs if you don't use VM names. |
image |
The operating system image used by the VM. This value has the following
format: projects/IMAGE_PROJECT/global/images/IMAGE_NAME . |
legacy-endpoint-access/ |
Stores the list of legacy endpoints. Values are 0.1 and
v1beta1 .
|
licenses/ |
A list of license code IDs that are used to attach the licenses to images, snapshots, and disks. |
machine-type |
The machine type for this VM. This value has the following format:
projects/PROJECT_NUM/machineTypes/MACHINE_TYPE
|
maintenance-event |
Indicates whether a maintenance event is affecting this VM. For more information, see Live migrate. |
name |
The name of the VM. |
network-interfaces/ |
A directory of network interfaces. For each network interface the following information is available:
For more information about network interfaces, see Multiple network interfaces overview. |
preempted |
A boolean value that indicates whether a VM is about to be preempted. |
scheduling/ |
Sets the scheduling options for the VM. Scheduling metadata values include the following:
For more information about scheduling options, see Setting instance availability policies. |
service-accounts/ |
A directory of service accounts associated with the VM. For each service account, the following information is available:
For more information about service accounts, see Creating and enabling service accounts for instances. |
tags |
Lists any network tags associated with the VM. For more information about network tags, see Configuring network tags. |
zone |
The zone where this VM is located. This value has the following format:
projects/PROJECT_NUM/zones/ZONE
|
Instance attributes
Instance attributes are stored under the following directory:
http://metadata.google.internal/computeMetadata/v1/instance/attributes/
Metadata entry | Description |
---|---|
enable-oslogin |
Enables or disables SSH key management on your VM. For more information about OS Login, see Setting up OS Login. |
vmdnssetting |
Enable zonal DNS and global DNS for the VM. For more information about internal DNS names, see Configuring DNS names. |
ssh-keys |
If you are
managing SSH keys using metadata,
this attribute lets you configure public SSH keys that can connect to VMs
in this project. If there are multiple SSH keys, each key is separated by
a newline character (
Example: SSH keys managed by OS Login aren't visible in metadata. |
Instance guest attributes
Instance guest attributes are stored under the following directory:
http://metadata.google.internal/computeMetadata/v1/instance/guest-attributes
Metadata entry | Description |
---|---|
guestInventory/ |
Stores OS inventory for the VM. Collects and stores OS details information. This includes information such as hostname, kernel version, architecture, and installed packages details. For more information about OS inventory, see Viewing operating system details. |
hostkeys/ |
Stores SSH host keys. Host keys can be used to identify a particular host or machine. For information host keys, see Storing host keys by enabling guest attributes. |
What's next?
- Learn more about VM metadata.
- Set custom metadata.
- Query VM metadata.
- Set and query guest attributes.