Cloud SQL Backup on Google Cloud is a service that allows you to back up data stored in Cloud SQL. In short, Cloud SQL is a managed cloud database service offered by Google Cloud that supports popular database engines such as MySQL, PostgreSQL, and SQL Server.
Backups in Cloud SQL play a key role in protecting data against loss due to failures, human errors, attacks or other types of incidents. Backups help you restore lost data on your Cloud SQL instance. If a problem occurs in an instance, you can use the backup to restore it to its previous state.
Google Cloud SQL Backups
The following are key features of Cloud SQL backups.
Automated Backups
In order to you have a backup of all your important data, you might want to configure automatic daily data backups. Google Cloud SQL stores these copies in a location only accessible to Google.
Backup Retention
If you have a lot of new data to back up, you can adjust how long a backup is retained. Old backups can be automatically deleted after a specified period of time.
Point-in-Time Recovery
In addition to full backups, Cloud SQL also allows you to restore your data to a specific point in time. This is useful when you want to go back to a specific moment before an error or data loss occurred.
Flexibility
You can manually create backups to have full control over the process. Additionally, you can create on-demand backups whenever the need arises.
Encryption
Data stored in the backup copy is encrypted, which protects it against unauthorized access.
Scalability
The service is designed to support both small and large applications, enabling flexible backup management.
To use Cloud SQL Backup in Google Cloud, you need to configure the appropriate settings in the Cloud SQL management panel for your database instance. This allows you to adjust the backup schedule, retention and other parameters according to the needs of your application.
Backup cost
First, it’s worth remembering that Cloud SQL stores seven automatic copies for each instance by default. However, you can change this number and create from one to 365 copies. Importantly, the cost of storing backups in Google Cloud is lower than for other instances.
What happens if you delete the instance yourself? Remember that all data, including backups, is permanently lost when the instance is deleted. You can always export it, for example using the Google Storage service to preserve it.
The restore operation is also possible, as Google Cloud will still have all your data for another four days, but to recover it you must contact Google Cloud support during this time. A safe solution in such a situation is to get assistance from a specialist, who will help you properly collect and provide all the necessary information to Googlers.
Backup types
Cloud SQL offers two types of backups: on-demand and automatic.
On demand backups
It is possible to create backups at any time. This is especially useful when you plan to perform a risky operation on the database or want to make a copy at a very specific moment, without waiting for automatic saving.
On-demand backups are not deleted automatically. They last until they are deleted or the instance is deleted. Therefore, they may have a long-term impact on billing fees.
Automatic backups
They are created every day during the four-hour backup window. As we mentioned earlier, the seven most recent backups are automatically saved. However, it is possible to set a different number in the range of 1 to 365.
Where are your backups stored
Backups can be stored in default locations designated by Cloud SQL, which are selected based on the location of the original instance. Another option is to store copies in custom locations, which you can designate if you don’t want to use the default location.
Default backup locations
Let’s see what happens when you choose the default backup location. In this case, it will be stored in the multiregion that is closest to the location of your Cloud SQL instance.
Custom backup locations
When should you choose a custom backup location? One such situation may be a legal requirement to store backups within certain geographic boundaries.
Chances are your organization has a resource location restriction policy in place, and you’ll see an alert on the backups page when you try to back up to another location. If you encounter such an alert, simply change your backup location to one that complies with your policy.
When choosing non-standard backup locations, it is worth considering several factors that may change. These are:
- Costs – it may turn out that one of the clusters in your instance may be located in a region with different costs than the others.
- Proximity to the application server – it is possible to store the backup copy as close as possible to the application to which the backup relates.
- Storage Usage – Over time, you will need more space to store new backups. Depending on your workload, you may have clusters of different sizes or with different levels of disk utilization, which may affect the cluster you choose.
Limitation of backup speed
Remember about the limitations that Cloud SQL imposes on the speed of backup operations to the data drive. A maximum of five such operations are allowed every 50 minutes for each instance in the project.
The limit applies only to successful operations, so if any of them fails, it is not included in the limit. Once the limit is reached, the operations will also fail and you will be notified with an appropriate message along with information about the date in which you can try again.
The diagram below shows how Cloud SQL limits backup speed.
Backup support
What should you do if you can’t see the status of a current operation or can’t back it up after deleting an instance? What if an automatic backup gets locked for hours and you can’t cancel it?
For more information about Cloud SQL backup, consult an FOTC expert. Certified Google Cloud architects will help you solve these and other problems that may arise when creating backups.