Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
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 service resource operations
    • Viewing metrics in Monitoring
    • NVIDIA driver update guide
  • Yandex Container Solution
  • Access management
  • Pricing policy
  • 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 July 29, 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 installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command 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 the 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 relevant documentation on the Terraform website or its mirror.

  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, go to the directory where you edited the configuration file.

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

      terraform validate
      

      If the configuration is correct, you will get this message:

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

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    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
© 2025 Direct Cursus Technology L.L.C.