Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Compute Cloud
    • All guides
      • Configuring metadata service parameters
      • Getting VM instance metadata
      • Getting a VM instance identity document
      • Changing VM instance metadata
      • Creating a VM with a custom configuration script
      • Creating a VM with metadata from environment variables
      • Creating a VM instance with access to a Yandex Lockbox secret
    • Viewing operations with resources
  • Yandex Container Solution
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Working with VM instance metadata
  3. Configuring metadata service parameters

Configuring parameters of the VM metadata service

Written by
Yandex Cloud
Updated at May 5, 2025

You can configure parameters of the VM metadata service when creating or updating the VM.

To configure metadata service parameters for a VM:

CLI
Terraform
API

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View the description of the CLI command for updating VM parameters:

    yc compute instance update --help
    
  2. Get a list of VMs in the default folder:

    yc compute instance list
    
  3. Select ID or NAME of the VM you need.

  4. Define the metadata service settings:

    yc compute instance update <VM_ID> \
      --metadata-options gce-http-endpoint=enabled
    

    Where --metadata-options is the parameter defining the settings of the VM metadata service. The possible values are:

    • gce-http-endpoint: Allows you to access metadata using the Google Compute Engine format. It can be either enabled or disabled.
    • gce-http-token: Allows you to get the service account IAM token for the VM using Google Compute Engine metadata. It can be either enabled or disabled.

    For more information, see VM instance metadata service parameters.

To configure parameters of the VM metadata service when creating the VM, use the --metadata-options parameter in the yc compute instance create command in the same way.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

  1. Open the Terraform configuration file and specify the metadata_options parameter in the VM description:

    ...
    resource "yandex_compute_instance" "test-vm" {
      ... 
      metadata_options {
        gce_http_endpoint    = 0
        gce_http_token       = 0
      }
      ...
    }
    ...
    

    Where:

    • yandex_compute_instance: VM description:

      • metadata_options: Metadata parameters:
        • gce_http_endpoint: Allows you to access metadata using the Google Compute Engine format. Possible values: 0, 1 for enabled and 2 for disabled.
        • gce_http_token: Allows you to get the service account IAM token for the VM using Google Compute Engine metadata. Possible values: 0, 1 for enabled and 2 for disabled.

      For more information, see VM instance metadata service parameters.

    For more information about the yandex_compute_instance resource parameters in Terraform, see this TF provider article.

  2. Create the resources:

    1. In the terminal, change to the folder where you edited the configuration file.

    2. Make sure the configuration file is correct using the command:

      terraform validate
      

      If the configuration is correct, the following message is returned:

      Success! The configuration is valid.
      
    3. Run the command:

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

    All the resources you need will then be created in the specified folder with the settings you defined. You can check the new resources and their settings using the management console or this CLI command:

    yc compute instance get <VM_name>
    

When creating a VM, use the create REST API method for the Instance resource or the InstanceService/Create gRPC API call.

When updating a VM, use the update REST API method for the Instance resource or the InstanceService/Update gRPC API call.

Was the article helpful?

Previous
Deleting a VM
Next
Getting VM instance metadata
Yandex project
© 2025 Yandex.Cloud LLC