gcloud compute instances ops-agents policies create POLICY_ID --file=FILE --zone=ZONE [GCLOUD_WIDE_FLAG …]
gcloud compute instances ops-agents policies create creates a
policy that facilitates agent management across Compute Engine instances based
on user specified instance filters. This policy installs, specifies versioning,
and removes Ops Agents.
The command returns the content of the created policy or an error indicating why
the creation fails. The created policy takes effect asynchronously. It can take
10-15 minutes for the VMs to enforce the newly created policy.
gcloud compute instances ops-agents policies create agent-policy --project=PROJECT --zone=ZONE --file=config.yamlPOLICY_ID--file=FILE--zone=ZONE--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.
gcloud alpha compute instances ops-agents policies creategcloud beta compute instances ops-agents policies creategcloud preview compute instances ops-agents policies create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.