El recomendador de instancias inactivas de Cloud SQL te ayuda a detectar instancias que podrían estar inactivas y te proporciona estadísticas y recomendaciones para ayudarte a reducir los costos. En esta página, se describe cómo funciona este recomendador y cómo usarlo.
Cómo funciona
El recomendador de instancias inactivas de Cloud SQL analiza las métricas de uso de las instancias principales con más de 30 días. Para cada instancia, el recomendador considera los valores de ciertas métricas dentro de un período de observación que abarca los últimos 30 días. El recomendador no analiza las réplicas de lectura.
Si el nivel de actividad dentro del período de observación está por debajo de un cierto umbral, el recomendador estima que la instancia está inactiva. Las recomendaciones se generan cada 24 horas por el cierre de esas instancias.
En la tarjeta Reduce el costo de la instancia de Cloud SQL, haz clic en Ver todo.
Haz clic en la pestaña Cerrar instancia.
gcloud
Para mostrar una lista de recomendaciones sobre instancias inactivas mediante gcloud, ejecuta el comando gcloud recommender recommendations list de la siguiente manera:
gcloud recommender recommendations list \
--project=PROJECT_ID \
--location=LOCATION \
--recommender=google.cloudsql.instance.RECOMMENDER
Reemplaza lo siguiente:
PROJECT_ID: ID del proyecto
LOCATION: Es una región, como us-central1.
RECOMMENDER: El ID del recomendador, como IdleRecommender.
API
Para mostrar una lista de recomendaciones sobre las instancias inactivas mediante la API de Recommendations, llama al método recommendations.list de la siguiente manera.
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations
Reemplaza lo siguiente:
PROJECT_ID: ID del proyecto
LOCATION: Es una región, como us-central1.
RECOMMENDER: El ID del recomendador, como IdleRecommender.
Si el recomendador detecta instancias inactivas, las enumera en una tabla. En cada fila, se muestra el nombre de la instancia, una recomendación breve, la ubicación y la última fecha de actualización.
Visualiza las estadísticas y las recomendaciones detalladas
Puedes ver estadísticas y recomendaciones detalladas sobre las instancias inactivas con la Google Cloud consola, gcloud o la API de Recommender.
Console
Para ver las estadísticas de una instancia inactiva con laGoogle Cloud consola, haz clic en el botón de recomendación en la lista de instancias.
gcloud
Para ver estadísticas y recomendaciones detalladas sobre las instancias inactivas mediante gcloud, ejecuta el comando gcloud recommender insights list de la siguiente manera:
gcloud recommender insights list \
--project=PROJECT_ID \
--location=LOCATION \
--insight-type=google.cloudsql.instance.INSIGHT_TYPE
Reemplaza lo siguiente:
PROJECT_ID: ID del proyecto
LOCATION: Es una región, como us-central1.
INSIGHT_TYPE: Es el ID del tipo de estadísticas ActivityInsight.
API
Para ver estadísticas y recomendaciones detalladas sobre las instancias inactivas mediante la API de Recomendaciones, llama al método insights.list de la siguiente manera:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights
Reemplaza lo siguiente:
PROJECT_ID: ID del proyecto
LOCATION: Es una región, como us-central1.
INSIGHT_TYPE: Es el ID del tipo de estadísticas ActivityInsight.
Aparecerá un panel en el que se mostrarán estadísticas sobre la instancia inactiva. Se proporcionan las siguientes categorías de información junto con algunos gráficos de apoyo.
Campos
Descripciones y métricas relacionadas
Uso del disco (cambio de bytes)
Uso de datos en bytes. Se tomaron muestras cada 60 segundos.
Pertenece a database/disk/bytes_used.
Uso máximo de CPU
El uso máximo de CPU como un porcentaje.
Pertenece a database/cpu/utilization.
Uso máximo de la memoria
El uso máximo de memoria como un porcentaje.
Pertenece a database/memory/utilization.
Recuento máximo de operaciones de lectura en el disco
La cantidad máxima de operaciones de lectura.
Pertenece a database/disk/read_ops_count.
Recuento máximo de operaciones de escritura en el disco
La cantidad máxima de operaciones de escritura.
Pertenece a database/disk/write_ops_count.
Fechas de inicio y finalización de la observación
Las fechas de inicio y finalización del período de observación de 30 días.
En la siguiente tabla, se enumeran la estadística y la recomendación que el recomendador de instancias inactivas de Cloud SQL podría generar para ayudarte a reducir los costos. Los subtipos se pueden ver en los resultados de gcloud y la API.
Estadística
Recomendación
La instancia mostró niveles bajos de actividad durante el período de observación.
Subtipo: LOW_ACTIVITY
Investiga si se puede cerrar la instancia para reducir costos.
Subtipo: SHUTDOWN_INSTANCE
Aplicar recomendaciones
Evalúa las recomendaciones con cuidado y realiza una de las siguientes acciones:
Para examinar la recomendación, haz clic en Ver instancia.
Aparecerá un banner en la parte superior de la página que proporciona una recomendación.
Es posible que descubras que la instancia está inactiva de forma intencional y que no necesitas cerrarla. Si está inactiva por accidente, puedes detenerla y borrarla. Detener una instancia suspende los cargos que genera. Los datos de la instancia no se verán afectados, y los cargos por el almacenamiento y las direcciones IP se seguirán aplicando.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[],[],null,["# Identify idle Cloud SQL instances\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/recommender-sql-idle \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/recommender-sql-idle \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\nThe Cloud SQL idle instance [recommender](/recommender/docs/overview) helps\nyou detect instances that might be idle and provides you\ninsights and recommendations to help you reduce costs. This page describes how\nthis recommender works and how to use it.\n\nHow it works\n------------\n\nThe Cloud SQL idle instance recommender analyzes the usage metrics of primary\ninstances that are older than 30 days. For each instance, the recommender\nconsiders the values of certain [metrics](/monitoring/api/metrics_gcp_c#gcp-cloudsql)\nwithin an observation period spanning the last 30 days. The recommender does not\nanalyze read replicas.\n\nIf the activity level within the observation period is below a certain\nthreshold, the recommender estimates that the instance is idle. Recommendations are\ngenerated every 24 hours for shutting down such instances.\n| **Warning:** It's highly recommended that you evaluate the insights and in-context charts. Consult with the appropriate team to determine whether the flagged instance is inadvertently idle and can be deleted.\n\nPricing\n-------\n\nThe Cloud SQL idle instance recommender is in the *Standard* [Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n----------------\n\nBefore you can view recommendations and insights, do the following:\n\n- To get the permissions to view and work with insights and recommendations, ensure that you have the required [roles](/sql/docs/sqlserver/project-access-control#roles).\n\n For more information about roles, see [understanding roles](/iam/docs/understanding-roles) and [granting IAM permissions](/iam/docs/granting-changing-revoking-access).\n-\n\n\n Enable the Recommender API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=recommender.googleapis.com)\n\nList idle Cloud SQL instance recommendations\n--------------------------------------------\n\nYou can list idle instance recommendations by\nusing the Google Cloud console, `gcloud`, or the Recommender API. \n\n### Console\n\nTo list recommendations about idle instances by using the\nGoogle Cloud console, follow these steps:\n\n1. Go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql/instances)\n2. Click **View all** on the idle instance recommendations banner.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub**.\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n\n For more information, see\n [Getting started with Recommendation Hub](/recommender/docs/recommendation-hub/identify-configuration-problems).\n2. In the **Reduce Cloud SQL instance cost** card, click **View all**.\n\n3. Click the **Shut down instance** tab.\n\n### gcloud\n\nTo list recommendations about idle instances by using `gcloud`, run the\n[`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list)\ncommand as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.RECOMMENDER\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `IdleRecommender`.\n\n### API\n\nTo list recommendations about idle instances by using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`recommendations.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.recommenders.recommendations/list)\nmethod as follows. \n\n```\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `IdleRecommender`.\n\nIf the recommender detects idle instances, it lists them in a\ntable. Each row shows the instance name, a brief recommendation, the location,\nand the last refresh date.\n\nView insights and detailed recommendations\n------------------------------------------\n\nYou can view insights and detailed recommendations about idle instances by\nusing the Google Cloud console, `gcloud`, or the Recommender API. \n\n### Console\n\nTo view insights about an idle instance by using the\nGoogle Cloud console, click the recommendation button in the list of instances.\n\n### gcloud\n\nTo view insights and detailed recommendations about idle instances by using `gcloud`, run the\n[`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list)\ncommand as follows: \n\n```\ngcloud recommender insights list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.INSIGHT_TYPE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `ActivityInsight`.\n\n### API\n\nTo view insights and detailed recommendations about idle instances by using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`insights.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.insightTypes.insights/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `ActivityInsight`.\n\nA panel appears showing insights about the idle instance. The following\ncategories of information are provided along with some supporting charts.\n\nThe following table lists the insight and recommendation that the Cloud SQL\nidle instance recommender might generate to help you reduce costs. The subtypes\nare visible in the `gcloud` and API results.\n\nApply recommendations\n---------------------\n\nEvaluate the recommendations carefully and do any of the following:\n\n- To examine the recommendation, click **View instance**.\n\n A banner appears at the top of the page providing a recommendation.\n\n You might find that the instance is intentionally idle and you don't need to shut\n it down. If it's inadvertently idle, you can [stop](/sql/docs/sqlserver/start-stop-restart-instance#stop)\n and [delete](/sql/docs/sqlserver/delete-instance) the instance. Stopping an\n instance suspends instance charges. The instance data is unaffected,\n and charges for storage and IP addresses continue to apply.\n\n Exercise caution when [stopping](/sql/docs/sqlserver/start-stop-restart-instance#stop)\n or [deleting](/sql/docs/sqlserver/delete-instance) an instance. To avoid\n the loss of data, [create a backup](/sql/docs/sqlserver/backup-recovery/backing-up#on-demand) first.\n- To dismiss the recommendation so that it's de-emphasized and appears dimmed,\n click **Dismiss**.\n\n- To close the panel without applying or dismissing the recommendation, click\n **Cancel**.\n\nYou can also [export these recommendations to BigQuery](/recommender/docs/bq-export/export-recommendations-to-bq)\nand examine them by using [Looker Studio](/bigquery/docs/visualize-looker-studio) or [Looker](/bigquery/docs/looker).\n\nWhat's next\n-----------\n\n- [Monitor disk availability](/sql/docs/sqlserver/using-ood-recommender)\n- [Reduce overprovisioned Cloud SQL instances](/sql/docs/sqlserver/recommender-sql-overprovisioned)\n- [Blog: Maximize your Cloud ROI](https://cloud.google.com/blog/products/management-tools/active-assist-comes-to-google-cloud)\n- [Blog: Do more with less](https://cloud.google.com/blog/products/databases/reduce-cloud-sql-costs-with-optimizations-by-active-assist)\n- [Google Cloud recommenders](/recommender/docs/recommenders)"]]