View placement policies Stay organized with collections Save and categorize content based on your preferences.
This document describes how to view placement policies.
Viewingplacement policies isuseful to see all the existing placement policies in a project, or verify theconfiguration details of a specific placement policy.
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:
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 view placement policies, ask your administrator to grant you theCompute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on your project. For more information about granting roles, seeManage access to projects, folders, and organizations.
This predefined role contains the permissions required to view placement policies. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to view placement policies:
- To view a list of your placement policies:
compute.resourcePolicies.liston the project - To view the details of a placement policy:
compute.resourcePolicies.geton the project
You might also be able to get these permissions withcustom roles or otherpredefined roles.
View your placement policies
To view the placement policies that are available in a project, select one ofthe following methods described in this document:
To see all the existing placement policies in a project,view a list of your placement policies.
To see the configuration details of a placement policy,view the details of a placement policy.
View a list of your placement policies
To view a list of all the placement policies in your project, select one of thefollowing options:
gcloud
To view a list of placement policies, use thegcloud compute resource-policies list commandwith the--filter flag set togroupPlacementPolicy:*.
gcloud compute resource-policies list \ --filter="groupPlacementPolicy:*"The output is similar to the following:
NAME: example-compact-policyDESCRIPTION:REGION: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1CREATION_TIMESTAMP: 2024-05-09T02:09:24.588-07:00NAME: example-spread-policyDESCRIPTION:REGION: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1CREATION_TIMESTAMP: 2024-05-09T02:08:13.404-07:00For more information about using filter expressions to narrow down a list ofCompute Engine resources, see thegcloud topic filters command.
REST
To view a list of placement policies that are located in a specific region,make aGET request to theresourcePolicies.list method.In the request URL, include thefilter query parameter and set it togroupPlacementPolicy%3A*.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/resourcePolicies?filter=groupPlacementPolicy%3A*Replace the following:
PROJECT_ID: the ID of the project in which you wantto view a list of placement policies.REGION: the region where one or more placementpolicies are located.
The output is similar to the following:
{ "kind": "compute#resourcePolicyList", "id": "projects/example-project/regions/us-central1/resourcePolicies", "items": [ { "kind": "compute#resourcePolicy", "id": "5587673659722509355", "creationTimestamp": "2024-05-09T02:09:24.588-07:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-compact-policy", "region": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1", "name": "example-compact-policy", "groupPlacementPolicy": { "collocation": "COLLOCATED" }, "status": "READY" }, { "kind": "compute#resourcePolicy", "id": "5970772604948130963", "creationTimestamp": "2024-05-09T02:08:13.404-07:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-spread-policy", "region": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1", "name": "example-spread-policy", "groupPlacementPolicy": { "availabilityDomainCount": 5 }, "status": "READY" } ], "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies", "etag": "-L7XCupTQ5V9__TOJ8G5RDcR2cY=/g_xt0udkOM_tU7jSL0z9I2Sivis="}For more information about using filter expressions to narrow down a list ofresource policies usingURL-encoding, see thefilter query parameter.
View the details of a placement policy
To view the details of a placement policy, select one of the following options:
gcloud
To view the details of a placement policy, use thegcloud compute resource-policies describe command.
maxDistance field in a compact placementpolicy, use thegcloud beta compute resource-policies describe commandinstead.gcloud compute resource-policies describePOLICY_NAME \ --region=REGIONReplace the following:
POLICY_NAME: the name of an existing placementpolicy.REGION: the region where the placement policy islocated.
The output is similar to the following:
If you're viewing the details of a compact placement policy:
creationTimestamp: '2024-05-09T02:09:24.588-07:00'groupPlacementPolicy: collocation: COLLOCATEDid: '5587673659722509355'kind: compute#resourcePolicyname: example-compact-policyregion: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1selfLink: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-compact-policystatus: READYIf you're viewing the details of a spread placement policy:
creationTimestamp: '2024-05-09T02:08:13.404-07:00'groupPlacementPolicy: availabilityDomainCount: 5id: '5970772604948130963'kind: compute#resourcePolicyname: example-spread-policyregion: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1selfLink: https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-spread-policystatus: READY
REST
To view the details of a placement policy, make aGET request to theresourcePolicies.get method.
maxDistance field in a compact placementpolicy, make aGET request to thebeta.resourcePolicies.get methodinstead.GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/resourcePolicies/POLICY_NAMEReplace the following:
PROJECT_ID: the ID of the project where the placementpolicy you want to view the details of is located.REGION: the region where the placement policy islocated.POLICY_NAME: the name of an existing placementpolicy.
The output is similar to the following:
If you're viewing the details of a compact placement policy:
{ "kind": "compute#resourcePolicy", "id": "5587673659722509355", "creationTimestamp": "2024-05-09T02:09:24.588-07:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-compact-policy", "region": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1", "name": "example-compact-policy", "groupPlacementPolicy": { "collocation": "COLLOCATED" }, "status": "READY"}If you're viewing the details of a spread placement policy:
{ "kind": "compute#resourcePolicy", "id": "5970772604948130963", "creationTimestamp": "2024-05-09T02:08:13.404-07:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/resourcePolicies/example-spread-policy", "region": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1", "name": "example-spread-policy", "groupPlacementPolicy": { "availabilityDomainCount": 5 }, "status": "READY"}
What's next?
Learn how toreplace, remove, or delete placement policies.
Learn how to apply a placement policy:
Learn how toverify the location of VMs that are using compact placement policies.
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 2026-02-18 UTC.