Prevent data loss for your instance by increasing backup retention Stay organized with collections Save and categorize content based on your preferences.
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This page describes the Cloud SQL increase backup retentionrecommender which helps you detect instances which are critical and have a risk of data loss.
The Cloud SQL increase backup retention recommender analyzes instance metadata. If the instance is a production instance, has automated backups enabled, and has less than 21 retained backups, it is recommended to increase its backup retention.
Recommendations are generated daily.
Pricing
The Cloud SQL increase backup retention recommender is in theStandardRecommender pricing tier.
Before you begin
Before you can view recommendations and insights, do the following:
- To get the permissions to view and work with insights and recommendations,ensure that you have the requiredIdentity and Access Management (IAM) roles.
For more information about IAM roles, seeIAM basic and predefined roles reference andManage access to projects, folders, and organizations.Tasks Roles View recommendations One of these roles: recommender.cloudsqlViewerorcloudsql.viewer.Apply recommendations One of these roles: recommender.cloudsqlAdmin,cloudsql.editor, orcloudsql.admin. Enable the Recommender API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission.Learn how to grant roles.
List reliability recommendations for increasing backup retention
You can list the increase backup retention recommendations byusing the Google Cloud console,gcloud CLI, or the Recommender API.
Console
To list increase backup retention recommendations using theGoogle Cloud console, follow these steps:
Go to theActive Assist.
For more information, seeGetting started with Recommendation Hub.
In theIncrease Cloud SQL instance reliability card, clickView all.
Select instances with theIncrease backup retention recommendation.
gcloud CLI
To list increase backup retention recommendations using gcloud CLI, run thegcloud recommender recommendations listcommand as follows:
gcloud recommender recommendations list \--project=PROJECT_ID \--location=LOCATION \--recommender=google.cloudsql.instance.ReliabilityRecommender \--filter=recommenderSubtype=INCREASE_BACKUP_RETENTION
Replace the following:
PROJECT_ID: Your project ID.LOCATION: A region where your instances are located, such asus-central1.
API
To list increase backup retention recommendations using theRecommendations API, call therecommendations.listmethod as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.ReliabilityRecommender/recommendations
Replace the following:
PROJECT_ID: Your project ID.LOCATION: A region where your instances are located, such asus-central1.
If the recommender detects instances for the increase backup retention recommendation, it lists them in a table. Each row shows the instance name, a brief recommendation, the current machine type, the recommended machine type, the location, and the last refresh date.
View insights and detailed recommendations
You can view insights and detailed recommendations about instancesthat require increasing their backup retention using the Google Cloud console,gcloud CLI, or the Recommender API.
Console
To view insights and detailed recommendations about instances that require increasing their backup retention, click the recommendation link in the list of instances.
gcloud CLI
To view insights and detailed recommendations about instances that require increasing their backup retention, run thegcloud recommender insights listcommand as follows:
gcloud recommender insights list \--project=PROJECT-ID \--location=LOCATION \--insight-type=google.cloudsql.instance.ReliabilityInsight \--filter=insightSubtype=CRITICAL_INSTANCE_INSUFFICIENT_BACKUP_RETENTION
Replace the following:
PROJECT_ID: Your project ID.LOCATION: A region where your instances are located, such asus-central1.
API
To view insights and detailed recommendations about instances that require increasing their backup retention, use theRecommendations API, call theinsights.listmethod as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.ReliabilityInsight/insights
Replace the following:
PROJECT_ID: Your project ID.LOCATION: A region where your instances are located, such asus-central1.
Apply recommendation
To implement this recommendation, do the following:
To increase backup retention:
- ClickIncrease backup retention in theIssues column.AnIncrease backup retention window displays providing a recommendation.
ClickEdit instance >Data protection >Number of backups.
For more information, seeAutomated backup and transaction log retention.
What's next
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.