View and apply idle resources recommendations

This document explains how to view and apply idle resources recommendations forPersistent Disk volumes, IP addresses, and custom disk images.

Compute Engine helps you identify idle Persistent Disk volumes, IPaddresses, and custom disk images, and provides recommendations to help youminimize waste and avoid unnecessary charges.

If you're interested in recommendations for idle virtual machine (VM) instances,then seeView and apply idle VM recommendations.

Before you begin

Pricing

There are no costs associated with using idle resources recommendations.

Recommendation generation

If a resource has not been attached to a VM or other resource for 15 days, thenthe Recommender classifies that resource as idle. For moreinformation about the conditions to classify a resource as idle and therecommended actions, see the following table:

ResourceCondition for resource to be classified as idleRecommended actionSavings
Persistent DiskAll of the following must be true:
  • The Persistent Disk was created at least 15 days ago.
  • The Persistent Disk was never attached to a VM.
  • The Persistent Disk is blank.
  • The Persistent Disk isn't bound to GKE Pods.
DeleteSave 100% of the cost of that disk. For more information, seeDisk and image pricing.
Persistent DiskAll of the following must be true:
  • The Persistent Disk was detached for at least 15 days.
  • The Persistent Disk isn't bound to GKE Pods.
Create a snapshot of the Persistent Disk, and then delete it.
Note: Depending on the location, the cost of the snapshot might be higher than the Persistent Disk. In such cases, the recommendation to create a snapshot doesn't appear, as it wouldn't generate any savings.
Reduce the maintenance cost of that disk from 35% to 92%. For more information, seeDisk and image pricing.
Custom imageAll of the following must be true:
  • The image wasn't used to create a disk for at least 15 days.
  • The image isn't used in any instance template.
DeleteSave 100% of the cost of that image. For more information, seeDisk and image pricing.
External IP addressThe IP address hasn't been attached to any resource for at least 15 days.Delete
Note: In some cases, you might receive recommendations to deleteBring your own IP addresses (BYOIP). You can ignore such recommendations, since you're not charged for idle BYOIP addresses.
Save 100% of the cost of that IP address. For more information, seeExternal IP address pricing.

Recommendation frequency

Idle resource recommendations begin 15 days after resource creation,and they are updated once every 24 hours.

Viewing recommendations

To view recommendations about idle resources, use the gcloud CLI orREST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • recommender.computeDiskIdleResourceRecommendations.list on the project for idle Persistent Disk volumes
  • recommender.computeAddressIdleResourceRecommendations.list on the project for idle IPs
  • recommender.computeImageIdleResourceRecommendations.list on the project for idle custom images

Console

In the Google Cloud console, go to theAll recommendations page.

Go to Recommendations

All idle resources are listed underUnused Compute Engine resources.

gcloud

Use thegcloud recommender recommendations list commandwith the--recommender=RECOMMENDER_ID flag:

gcloud recommender recommendations list \    --project=PROJECT_ID \    --location=LOCATION \    --recommender=RECOMMENDER_ID \    --format=yaml

Replace the following:

  • PROJECT_ID: the ID of your project.
  • LOCATION: the location that contains the resourcesfor which you want recommendations.
    • For Persistent Disk volumes specify a zone or region; for example,us-central1-c.
    • For IPs:
      • To list regional IPs, you must specify a region.
      • To list global IPs, specifyglobal.For more information about regional and global IP address resources,seeIP addresses.
    • For custom images specifyglobal.
  • RECOMMENDER_ID: the ID ofrecommender
    • For disks, specifygoogle.compute.disk.IdleResourceRecommender.
    • For images, specifygoogle.compute.image.IdleResourceRecommender.
    • For IPs, specifygoogle.compute.address.IdleResourceRecommender.

For example, the following command lists idle Persistent Diskrecommendations inus-central1-c fortest-project:

gcloud recommender recommendations list \    --project=test-project \    --location=us-central1-c \    --recommender=google.compute.disk.IdleResourceRecommender \    --format=yaml---content:    operationGroups:    - operations:      - action: add        resource: //compute.googleapis.com/projects/test-project/global/snapshots/$snapshot-name        resourceType: compute.googleapis.com/Disk        path: /        value:        - name: $snapshot-name          sourceDisk: projects/test-project/locations/us-central1-c/disks/pd-name          storageLocations: us-central1      - action: remove        resource: //compute.googleapis.com/projects/test-project/zones/us-central1-c/disks/pd-name        resourceType: compute.googleapis.com/Disk        path: /description: Save cost by snapshotting and then deleting idle persistent disk 'pd-name'name: projects/test-project/locations/us-central1-c/recommenders/google.compute.disk.IdleResourceRecommender/recommendations/0fd31b24-cc05-4132-8431-ed54a22dd4f1recommenderSubtype: SNAPSHOT_AND_DELETE_DISKlastRefreshTime:  seconds: 1543912652primaryImpact:  category: COST  costProjection:    cost:      currencyCode: USD      units: '-50'    duration:      seconds: 2592000stateInfo: ACTIVEetag: "cb0e6ac2cfc0b591"

Learn more about using gcloud CLI to work withrecommendations.

REST

Call therecommendations.list methodand specify therecommender id,for examplegoogle.compute.disk.IdleResourceRecommender:

GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/RECOMMENDER_ID/recommendations

Replace the following:

  • PROJECT_ID: the ID of your project.
  • LOCATION: the location that contains the resourcesfor which you want recommendations.
    • For Persistent Disk volumes specify a zone or region; for example,us-central1-c.
    • For IPs:
      • To list regional IPs, you must specify a region.
      • To list global IPs, specifyglobal.For more information about regional and global IP address resources,seeIP addresses.
    • For custom images specifyglobal.
  • RECOMMENDER_ID: the ID ofrecommender
    • For disks, specifygoogle.compute.disk.IdleResourceRecommender.
    • For images, specifygoogle.compute.image.IdleResourceRecommender.
    • For IPs, specifygoogle.compute.address.IdleResourceRecommender.

The following example shows out to send a request withcurl, and theassociated sample response.

PROJECT_ID=test-projectLOCATION=us-central1-cRECOMMENDER_ID=google.compute.disk.IdleResourceRecommendercurl -H "Authorization: Bearer $(gcloud auth print-access-token)" \  https://recommender.googleapis.com/v1/projects/$PROJECT_ID/locations/$LOCATION/recommenders/$RECOMMENDER_ID/recommendations

Example JSON response for idle Persistent Disk recommendation:

{ "description" : "Save cost by deleting idle persistent disk 'pd-name'", "name": "projects/test-project/locations/us-central1-c/recommenders/"         "google.compute.disk.IdleResourceRecommender/"         "recommendations/0fd31b24-cc05-4132-8431-ed54a22dd4f1", "recommenderSubtype" : "SNAPSHOT_AND_DELETE_DISK", "lastRefreshTime": {   "seconds": 1543912652 }, "primaryImpact": {   "category": COST,   "costProjection": {    "cost": {"currencyCode": "USD", "units": -50},    "duration": { "seconds": 2592000 }   } }, "stateInfo": ACTIVE, "content": {   "operationGroups" : [    {      "operations" : [       {         "action": "add",         "resourceType": "compute.googleapis.com/Disk",         "resource" : "//compute.googleapis.com/projects/test-project/global/snapshots/$snapshot-name",         "value": {           "name": "$snapshot-name",           "sourceDisk": "projects/test-project/zones/us-central1-c/disks/pd-name",           "storageLocations": ["us-central1"],         }       },       {         "action": "remove",         "resourceType": "compute.googleapis/Disk",         "resource": "//compute.googleapis.com/projects/test-project/"                     "zones/us-central1-c/disks/pd-name"       }      ]    }   ] }, "associatedInsights": [    {      "insight": "projects/test-project/locations/us-central1-c/insightTypes/google.compute.disk.IdleResourceInsight/insights/31326443-bcc3-4776-9b86-48879fddb656"    }  ], "etag": "cb0e6ac2cfc0b591"}

Interpreting the recommendation response

Each recommendation that you receive through the gcloud CLI or RESTcontains operation groups, with operations that you can perform in serial toapply the recommendation. For example, idle Persistent Disk recommendationoperation groups include one or two operations:

  • If your idle Persistent Disk has data on it, then the recommendationincludes anadd operation to create a snapshot to back up thePersistent Disk. For example:

       {     "action": "add",     "resourceType": "compute.googleapis.com/Disk",     "resource" : "//compute.googleapis.com/projects/test-project/global/snapshots/$snapshot-name",     "path": "/",     "value": {       "name": "$snapshot-name",       "sourceDisk": "projects/test-project/zones/us-central1-c/disks/pd-name",       "storageLocations": ["us-central1"]     }   }
  • Aremove operation to permanently delete the idle Persistent Disk. Forexample:

       {     "action": "remove",     "resourceType": "compute.googleapis.com/Disk",     "resource" : "//compute.googleapis.com/projects/test-project/zones/us-central1-c/disks/pd-name",     "path": "/"   }

Viewing insights for idle resource recommendations

The Recommender generates recommendations basedon resourceinsights.By viewing insights on resources you can learn more about those resources, suchas how long a resource has been detached from a VM or whether aPersistent Disk is blank.

If you want to view theinsightthat generated the recommendation, you can use the gcloud CLIor REST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • recommender.computeDiskIdleResourceInsights.list on the project for idle PDs
  • recommender.computeAddressIdleResourceInsights.list on the project for idle IPs
  • recommender.computeImageIdleResourceInsights.list on the project for idle images

gcloud

Use theinsights list command

gcloud beta recommender insights list --project=PROJECT_NAME \  --location=LOCATION --insight-type=INSIGHT_TYPE

Replace the following:

  • LOCATION: the location that contains the resources for which you want insights.
    • For PDs specify a zone or region, for example,us-central1-c.
    • For IPs:
      • To list regional IPs, you must specify a region.
      • To list global IPs, specifyglobal.For more information about regional and global IP address resources,seeIP addresses.
    • For custom images specifyglobal.
  • INSIGHT_TYPE: the ID of theinsight type
    • For disks, specifygoogle.compute.disk.IdleResourceInsight.
    • For images, specifygoogle.compute.image.IdleResourceInsight.
    • For IPs, specifygoogle.compute.address.IdleResourceInsight.

REST

Use theinsights.list method.

GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/insightTypes/INSIGHT_TYPE/insights

Replace the following:

  • PROJECT_ID: the ID of your project.
  • LOCATION: the location that contains the resourcesfor which you want insights.
    • For Persistent Disk volumes specify a zone or region; for example,us-central1-c.
    • For IPs:
      • To list regional IPs, you must specify a region.
      • To list global IPs, specifyglobal.For more information about regional and global IP address resources,seeIP addresses.
    • For custom images specifyglobal.
  • INSIGHT_TYPE: the ID of theinsight type
    • For disks, specifygoogle.compute.disk.IdleResourceInsight.
    • For images, specifygoogle.compute.image.IdleResourceInsight.
    • For IPs, specifygoogle.compute.address.IdleResourceInsight.

Here is an example response of an insight on an idle Persistent Diskresource:

{  "name": "projects/test-project/locations/us-central1-c/insightTypes/google.compute.disk.IdleResourceInsight/insights/0ec21a13-bb04-3121-7321-dc43a11cc3e2",  "description": "Disk 'pd-name' in zone 'us-central1-c' was last used 17 days ago. Consider taking snapshot and delete it.",  "targetResources": [    "//compute.googleapis.com/projects/test-project/zones/us-central1-c/disks/pd-name"  ],  "insightSubtype": "IDLE_DISK",  "content": {    "diskLastUseTime": "2019-10-01 13:00:00",    "isBlank": false,  },  "lastRefreshTime": "2019-10-10 13:00:00",  "observationPeriod": "15 days",  "stateInfo": {    "state": "ACTIVE"  },  "category": "COST",  "etag": "fds421j2349",  "associatedRecommendations": [    {      "projects/test-project/locations/us-central1-c/recommenders/"      "google.compute.disk.IdleResourceRecommender/"      "recommendations/0fd31b24-cc05-4132-8431-ed54a22dd4f1"    }  ]}

The example response includes the following fields:

  • diskLastUseTime: The last time when the disk was attached toa VM. If the disk was never attached to a VM this is set to the disk'screation time.
  • isBlank: This field is set totrue if disk is blank and was neverattached to VM. Otherwise it isfalse.

For more information about insights, see thereference docs.

Applying idle resource recommendations

If you receive a recommendation about an idle resource and you decidethat you want to apply the recommendation, then follow the instructions in thenext sections.

Deleting idle IP address

See theaddresses.delete method,gcloud compute addresses delete command,or theReleasing a static external IP addressdocumentation.

Deleting idle custom images

See theimages.delete method,gcloud compute images delete command,or theDeleting an imagedocumentation.

Applying idle Persistent Disk recommendations

If you need to create a snapshot of a Persistent Disk prior to deleting it,then seeCreating persistent disk snapshots.

To delete an idle Persistent Disk, see thegcloud compute disks delete command.

For information about how to recover data from a snapshot and recreate yourPersistent Disk, seeRestoring snapshots.

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.