gcloud compute instances ops-agents policies delete

NAME
gcloud compute instances ops-agents policies delete - delete a Google Cloud Observability agents policy for the Ops Agent
SYNOPSIS
gcloud compute instances ops-agents policies deletePOLICY_ID--zone=ZONE[GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute instances ops-agents policies delete deletes apolicy that facilitates agent management across Compute Engine instances basedon user specified instance filters.

The command returns a response indicating whether the deletion succeeded. Aftera policy is deleted, it takes 10-15 minutes to be wiped from the applicableinstances. Deleting a policy does not delete any existing agents managed by thatpolicy, but the agents become unmanaged by any policies. To remove the agentsfrom the instances, first update the policy to set the agentpackageState toremoved, wait for the policy to takeeffect, then delete the policy.

The command returns the content of the deleted policy. For instance:

agentsRule:packageState:installedversion:latestinstanceFilter:inclusionLabels:-labels:env:prod

If no policies are found, or the policy is not an agents policy, then thecommand returns aNOT_FOUND error.

EXAMPLES
To delete an agents policy namedops-agents-test-policy in the currentproject, run:
gcloudcomputeinstancesops-agentspoliciesdeleteops-agents-test-policy--zone=ZONE
POSITIONAL ARGUMENTS
POLICY_ID
ID of the policy.

This ID must contain only lowercase letters, numbers, and hyphens, end with anumber or a letter, be between 1-63 characters, and be unique within theproject.

REQUIRED FLAGS
--zone=ZONE
Zone of the agents policy you want to delete.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
These variants are also available:
gcloudalphacomputeinstancesops-agentspoliciesdelete
gcloudbetacomputeinstancesops-agentspoliciesdelete

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-07-22 UTC.