View and apply idle resources recommendations Stay organized with collections Save and categorize content based on your preferences.
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
- 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.
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:
| Resource | Condition for resource to be classified as idle | Recommended action | Savings |
|---|---|---|---|
| Persistent Disk | All of the following must be true:
| Delete | Save 100% of the cost of that disk. For more information, seeDisk and image pricing. |
| Persistent Disk | All of the following must be true:
| 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 image | All of the following must be true:
| Delete | Save 100% of the cost of that image. For more information, seeDisk and image pricing. |
| External IP address | The 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.liston the project for idle Persistent Disk volumesrecommender.computeAddressIdleResourceRecommendations.liston the project for idle IPsrecommender.computeImageIdleResourceRecommendations.liston the project for idle custom images
Console
In the Google Cloud console, go to theAll recommendations page.
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, specify
global.For more information about regional and global IP address resources,seeIP addresses.
- For custom images specify
global.
- For Persistent Disk volumes specify a zone or region; for example,
RECOMMENDER_ID: the ID ofrecommender- For disks, specify
google.compute.disk.IdleResourceRecommender. - For images, specify
google.compute.image.IdleResourceRecommender. - For IPs, specify
google.compute.address.IdleResourceRecommender.
- For disks, specify
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, specify
global.For more information about regional and global IP address resources,seeIP addresses.
- For custom images specify
global.
- For Persistent Disk volumes specify a zone or region; for example,
RECOMMENDER_ID: the ID ofrecommender- For disks, specify
google.compute.disk.IdleResourceRecommender. - For images, specify
google.compute.image.IdleResourceRecommender. - For IPs, specify
google.compute.address.IdleResourceRecommender.
- For disks, specify
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 an
addoperation 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"] } }A
removeoperation 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.liston the project for idle PDsrecommender.computeAddressIdleResourceInsights.liston the project for idle IPsrecommender.computeImageIdleResourceInsights.liston 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, specify
global.For more information about regional and global IP address resources,seeIP addresses.
- For custom images specify
global.
- For PDs specify a zone or region, for example,
INSIGHT_TYPE: the ID of theinsight type- For disks, specify
google.compute.disk.IdleResourceInsight. - For images, specify
google.compute.image.IdleResourceInsight. - For IPs, specify
google.compute.address.IdleResourceInsight.
- For disks, specify
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, specify
global.For more information about regional and global IP address resources,seeIP addresses.
- For custom images specify
global.
- For Persistent Disk volumes specify a zone or region; for example,
INSIGHT_TYPE: the ID of theinsight type- For disks, specify
google.compute.disk.IdleResourceInsight. - For images, specify
google.compute.image.IdleResourceInsight. - For IPs, specify
google.compute.address.IdleResourceInsight.
- For disks, specify
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 totrueif 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.