Create an instance for Ops Agent monitoring and logging Stay organized with collections Save and categorize content based on your preferences.
Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Required roles
To get the permissions that you need to create an instance for Ops Agent monitoring and logging, ask your administrator to grant you the following IAM roles on the project:
- Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1) - To install the Ops Agent on the instance:OSPolicyAssignment Editor (
roles/osconfig.osPolicyAssignmentEditor)
For more information about granting roles, seeManage access to projects, folders, and organizations.
You might also be able to get the required permissions throughcustom roles or otherpredefined roles.
Create an instance for the Ops Agent monitoring and logging
You can create an instance that's configured for Ops Agent monitoring andlogging only by using the Google Cloud console. This section briefly describes howto install the Ops Agent while creating an instance. For more information, alsoseeInstall Ops Agent during instance creation.
In the Google Cloud console, go to theCreate an instance page.
If prompted, select your project and clickContinue.
TheCreate an instance page appears and displays theMachine configuration pane.
In the navigation pane, clickObservability. TheObservability pane appears.
In theOps Agent section, select theInstall the Ops Agent for Monitoring and Logging checkbox.
Selecting this checkbox enables VM Manager in limited capability mode and it creates an OS policy assignment for installing Ops Agent on the instance.
Optional: Specify other configuration options. For more information, seeConfiguration options during instance creation.
To create and start the instance, clickCreate.
Install the Ops Agent on existing instances
You can use the Google Cloud console, the gcloud CLI, or an automationtool to install Ops Agent on a fleet of instances or on individual instances.For detailed instructions, seeInstall the Ops Agent.
Note: If you install the Ops Agent, then you might be charged for the metricsand logs that the agent sends to your Google Cloud project. For moreinformation, seeGoogle Cloud Observability pricing.What's next
- Learn how tocheck the status of an instanceto see when it is ready to use.
- Learn how toconnect to your instance0.
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.