Manage VM extensions by using extension policies Stay organized with collections Save and categorize content based on your preferences.
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
VM Extension Manager uses extension policies to manage your VM extensions at scale.For more information, seeAbout VM Extension Manager.This document describes how to view, update, and delete VM extension policies.
IAM roles and permissions
To get the permissions that you need to view, modify, and delete VM extension policies, ask your administrator to grant you the following IAM roles on the project:
- To view extension policies:
- VM Extension Policy Viewer (
roles/compute.vmExtensionPolicyViewer) - VM Extension Policy Admin (
roles/compute.vmExtensionPolicyAdmin)
- VM Extension Policy Viewer (
- To modify extension policies:VM Extension Policy Admin (
roles/compute.vmExtensionPolicyAdmin) - To delete extension policies:VM Extension Policy Admin (
roles/compute.vmExtensionPolicyAdmin)
For more information about granting roles, seeManage access to projects, folders, and organizations.
These predefined roles contain the permissions required to view, modify, and delete VM extension policies. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to view, modify, and delete VM extension policies:
- To view extension policies:
compute.vmExtensionPolicies.list - To view details of an extension policy:
compute.vmExtensionPolicies.get - To modify extension policies:
compute.vmExtensionPolicies.update - To delete extension policies:
compute.vmExtensionPolicies.delete
You might also be able to get these permissions withcustom roles or otherpredefined roles.
For more information about IAM roles and permissions inCompute Engine, seeCompute Engine roles and permissions.
View extension policies
You can view a list of VM extension policies in your project, or view thedetails of a specific policy by using the Google Cloud console or theGoogle Cloud CLI.
Console
- In the Google Cloud console, go to theVM extension policies page.This page lists all the VM extension policies in your project.
- To view details of a specific extension policy, click the name of the policy.
gcloud
To view all extension policies in a project, use thegcloud beta compute zone-vm-extension-policies list command:
gcloudbetacomputezone-vm-extension-policieslist\--project=PROJECT_ID\--zone=ZONE\--page-size=PAGE_SIZE
Replace the following:
PROJECT_ID: the ID of your Google Cloud project.ZONE: the name of the zone where you want to list VM extension policies.PAGE_SIZE: the maximum number of results to return per page.
To view details of a specific extension policy, use thegcloud beta compute zone-vm-extension-policies describe command:
gcloudbetacomputezone-vm-extension-policiesdescribePOLICY_NAME\--project=PROJECT_ID\--zone=ZONE
Replace the following:
POLICY_NAME: the name of the VM extension policy you want to describe.PROJECT_ID: your Google Cloud project ID.ZONE: the Google Cloud zone where the VM extension policy is located.
Modify extensions by updating a VM extension policy
When you update a policy, VM Extension Manager rolls out the changes toall applicable VMs, typically within one minute. If you modify inclusion labels,extensions might be installed on new VMs or uninstalled from existing VMsbased on whether they match the updated labels.
Console
- In the Google Cloud console, go to theVM extension policies page.
- Select the policy that you want to update.
- ClickEdit.
- Modify theDescription,Priority,Extensions, orTarget VM instances.
- ClickSave.
gcloud
Use thegcloud beta compute zone-vm-extension-policies update command to modify anexisting VM extension policy. When you update a policy by using gcloud, the request acts as acomplete replacement. Any optional fields you omit revert to their defaultvalues instead of retaining existing values from the modified policy.
To update a VM extension policy, run the following command:
gcloudbetacomputezone-vm-extension-policiesupdatePOLICY_NAME\--zone=ZONE\--extensions=EXTENSION_NAME_1,EXTENSION_NAME_2\--version=EXTENSION_NAME_1=VERSION_1,EXTENSION_NAME_2=VERSION_2\--config-from-file=EXTENSION_NAME_1=CONFIG_FILE_PATH_1,EXTENSION_NAME_2=CONFIG_FILE_PATH_2\--inclusion-labels=KEY_1=VALUE_1\--priority=PRIORITY_NUMBER\--description="DESCRIPTION"
Replace the following:
POLICY_NAME: a name of the VM extension policy to update.ZONE: the Google Cloud zone where the policy applies.EXTENSION_NAME_1,EXTENSION_NAME_2: the names of the extensions to update. You must specify at least one extension.VERSION_1: the version of the first VM extension.VERSION_2: the version of the second VM extension.EXTENSION_NAME_1=CONFIG_FILE_PATH_1,EXTENSION_NAME_2=CONFIG_FILE_PATH_2: a comma-separated list of key-value pairs where the key isthe extension name and value is the path to the configuration file forthat extension. This path is on the VM where you run thegcloudcommand, not on the VM where you install the extension.Alternatively, to provide configuration as inline string, use the
--configflag instead of--config-from-file—for example,EXTENSION_NAME_1="CONFIG_1".You can use either--config-from-fileor--config, but not both inthe same command.KEY_1=VALUE_1: a comma-separated listof key-value pairs that define inclusion labels for a selector. VMs musthave all specified labels in a selector to be targeted. If you specify--inclusion-labelsmultiple times, the policy targets VMs that matchany of the provided selectors (logical OR). If you omit this flag, thepolicy targets all VMs in the specified zone.PRIORITY_NUMBER: the priority number for the VM extension policy.DESCRIPTION: a description of the VM extension policy.
Uninstall extensions by deleting a VM extension policy
When you delete a policy, VM Extension Manager uninstalls the extensionsfrom any VMs managed by that policy. However, if another active, lower-priority policyapplies to a VM and declares the same extension, the extension remains installedon that VM based on the lower-priority policy.
VM Extension Manager removes extensions from all accessible VMs withinone minute of policy deletion. If a VM is inaccessible because the guest agent isremoved or the VM is deleted, VM Extension Manager skips deletion of the extension.If such a VM becomes available again, VM Extension Manager removes the extensions at that time.
Console
- In the Google Cloud console, go to theVM extension policies page.
- Select the policy that you want to delete.
- ClickDelete.
- In the confirmation dialog, clickDelete.
gcloud
Use thegcloud beta compute zone-vm-extension-policies delete command to delete an existing VM extension policy.
gcloudbetacomputezone-vm-extension-policiesdeletePOLICY_NAME\--project=PROJECT_ID\--zone=ZONE
Replace the following:
POLICY_NAME: the name of the VM extension policy you want to delete.PROJECT_ID: the ID of your Google Cloud project.ZONE: the Google Cloud zone where the policy is located.
Troubleshoot VM extensions
This section describes how to troubleshoot issues with VM extensions.
Verify that an extension is installed
You can verify that an extension is installed by checking the following on theVM:
Connect to the VM and check for runningprocesses.
The following table lists the process names for each extension:
Extension name Extension process name google-cloud-sap-extensiongoogle_cloud_sap_agentgoogle-cloud-workload-extensiongoogle_cloud_workload_agentops-agentops-agentLinux
Replacepsaux|grep'EXTENSION_PROCESS_NAME'
EXTENSION_PROCESS_NAMEwith the process name of the extension.For example, to check the Ops Agent process, run the following command:psaux|grep'ops-agent'
Windows
Replacetasklist|findstr"EXTENSION_PROCESS_NAME"
EXTENSION_PROCESS_NAMEwith the process name of the extension.For example, to check the Ops Agent process, run the following command:tasklist|findstr"ops-agent"
The output of the
pscommand on a Linux VM for the Ops Agent might show anentry similar to the following:..../var/lib/google-guest-agent/931374772276853249/plugins/ops-agent_baddabb3dac3....
Enable and review guest agent logs. The guest agentlogs show when an extension is installed and started.
The following is an example of the output you might see in the guest agent logswhen an Ops Agent extension is installed:
my-instancegoogle_guest_agent[14972]:Installingplugin"ops-agent",revision"2dfa648c1892da87"my-instancegoogle_guest_agent[14972]:(client.go:181)Sentmessage[[type.googleapis.com/agent_controlplane.PluginEventMessage:(revision_id:"2dfa648c1892da87)]]my-instance google_guest_agent [14972]: (pluginengine.go:202) Running "DownloadPluginStep" on plugin "ops-agent_2dfa648c1892da87"my-instance google_guest_agent [14972]: (pluginengine.go:316) Successfully downloaded "https://storage.googleapis.com/acp-gcs-bucket-us-centrall-a/ops-agentmy-instancegoogle_guest_agent[14972]:(pluginengine.go:202)Running"UnpackPluginArchiveStep"onplugin"ops-agent_2dfa648c1892da87"my-instancegoogle_guest_agent[14972]:(pluginengine.go:361)Successfullyunpacked"/var/lib/google-guest-agent/ops-agent.tar.gz"to"/google-guest-agent/ops-agent_2dfa648c1892da87my-instance google_guest_agent [14972]: (pluginengine.go:202) Running "LaunchPluginStep" on plugin "ops-agent_2dfa648c1892da87"my-instance google_guest_agent [14972]: (run_linux.go:32) Attempting process start: (OutputType:0 Name:/var/lib/google-guest-agent/plugins/ops-agent_2dfa648c1892da87)my-instance google_guest_agent [14972]: (pluginlauncher.go:132) Launched a plugin process from "/var/lib/google-guest-agent/plugins/ops-agent_2dfa648c1892da87"my-instance google_guest_agent [14972]: (plugin.go:136) Dialing in on plugin "ops-agent2dfa648c1892da87"my-instance google_guest_agent [14972]: (plugin.go:51) Executing start request on plugin "ops-agent_2dfa648c1892da87"
Troubleshoot installation issues
If an extension isn't installed on a VM after you create a policy, use thefollowing steps to troubleshoot the issue:
- Wait for policy enforcement. It can take up to an hour for a policy to beapplied, including any retries.
- Check that the inclusion labels specified in the policy match the labels onthe VM.
- To identify potential installation errors,enable debug logging for theguest agent.
After you fix the underlying issue, retry the installation by using one ofthe following methods:
- Recreate the policy:Delete the policy and thencreate a new policy.
Use a temporary high-priority policy: If you want to avoid recreating apolicy that affects many VMs, use a temporary, higher-priority policy toretry the installation on specific VMs:
- Add a new label to the VMs for which the installation failed. For example, add a label
status=failed. - Create a policy with a higher priority that targets the new label.For example, if the original policy that failed had the default priority of
1000,create a policy with a higher priority, such as500.gcloudbetacomputezone-vm-extension-policiescreatetemp-policy
--project=test-project
--zone=us-central1-f
--extensions=ops-agent
--config-from-file=ops-agent="/usr/ops-agent-config.yaml"
--priority=500
--inclusion-labels=status=failed - After the extension is installed successfully, delete the temporarypolicy andremove the label from the VMs.The extension remains installed because the original policy is still active.
- Add a new label to the VMs for which the installation failed. For example, add a label
View debug logs for the guest agent
To enable debug logging, add log level and verbosity settings to theCore section of the guestagent configuration file as follows:
Linux
- Open the guest agent configuration file located at
/etc/default/instance_configs.cfg. Add the following lines to the file. If the
[Core]section alreadyexists, add thelog_levelandlog_verbositysettings to it.[Core]log_level = 4log_verbosity = 4Restart the guest agent manager by running the following command:
sudosystemctlrestartgoogle-guest-agent-managerTo view logs for guest agent activity during extension installation, runthe following command:
journalctl-ugoogle-guest-agent-manager
Windows
- Open the guest agent configuration file located at
C:\ProgramFiles\Google\Compute Engine\instance_configs.cfg. Add the following lines to the file. If the
[Core]section alreadyexists, add thelog_levelandlog_verbositysettings to it.[Core]log_level = 4log_verbosity = 4Restart the guest agent manager by running the following command as Windows administrator:
net stop GCEAgentManager net start GCEAgentManagerTo view logs for guest agent activity during extension installation, runthe following command in PowerShell:
Get-Eventlog-Sourcegoogle_guest_agent_manager-LogNameApplication
After enabling debug logs, check for the following common errors:
- Not enough disk space: If the logs report insufficient disk space, freeup space on the disk or resize the disk to add more space.
- Excessive resource usage: If the logs indicate the guest agent stopped the extension due to excessive memory or CPU usage, change the VM's machine type to one with more resources.
What's next
- Learn more aboutVM Extension Manager.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.