Description
Cloud SQL allows you to create backups either on‑demand or through an automated schedule. The backup settings available depend on the option configured for your instance. These backups are incremental, enabling you to recover lost data efficiently. By default, all backups are encrypted using either Google‑managed keys or Customer‑Managed Encryption Keys (CMEK).
In this guided lab, you will learn how to safeguard your Cloud SQL databases by creating manual backups and restoring them to a new instance. This ensures you can recover data in case of accidental loss.
Prerequisites
This lab assumes you have knowledge of Cloud SQL and Cloud SQL Studio.
If you find any gaps in your knowledge, consider taking this lab:
Objectives
In this lab, you will:
- Create a Cloud SQL instance.
- Add a user account and database.
- Insert sample data into a table.
- Create a manual backup of your instance.
- Restore the backup to a new instance.
- Validate that the restored instance contains your data.
Lab Steps
Create a Cloud SQL instance
1. Go to Cloud SQL, then click Create Sandbox instance.
2. On the Create a MySQL instance page, set the Edition preset to Sandbox.
3. Enter your desired Instance ID.
4. Set a desired password for the root user.

5. Leave other configurations at their default values.
6. Click Create instance to start creating the instance.
Add a User Account
1. Once the instance is created, go to the Users tab.

2. Click Add user account.
3. Enter the desired User name and Password.

3. Click Add. A confirmation message will appear in the bottom‑left corner

Create a Database
1. Navigate to the Databases tab.

2. Click Create database.
3. Enter a Database name (e.g., EmployeesDB).

4. Once done, click Create.
Add Sample Data (Preparation for Backup)
1. Open the Cloud SQL Studio tab from your instance page.
2. Select the database you created (e.g., EmployeesDB).
3. Enter the credentials for the user account you added earlier and click Authenticate.
4. Once authenticated, open the Untitled Query Editor.
5. Create a new table to store employee records by running:
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Salary DECIMAL(10, 2)
);
6. Insert sample data into the table:
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (1, 'Jose Rizal', 25, 50000.00);
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (2, 'Andres Bonifacio', 25, 50000.00);
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (3, 'Emilio Aguinaldo', 25, 50000.00);
7. Verify the data by running:
SELECT * FROM Employees;
This will display the three employee records you inserted.

Create a Backup
1. In the left panel, click Backups.

2. Click Create Backup.
3. (Optional) Enter a name for the backup. If left blank, Google Cloud will generate one automatically. For this demo, name it “Manual backup.”

4. Click Create.
5. Wait for the backup to complete. You will see it listed under the Backups tab.

Restore from a Backup
1. In the Backups tab, select the backup you want to restore.

2. Click Restore.
3. Choose whether to restore to the same instance or create a new instance.
- Restoring to the same instance will overwrite existing data.
- Restoring to the existing instance will overwrite an existing compatible instance from your project.
- Restoring to a new instance allows you to test or recover without affecting production.
For this demo, choose Restore to a new instance.

4. Click Restore and wait for the process to complete.

Validate the Restored Instance
1. Open Cloud SQL Studio in the Google Cloud Console and connect to your restored Cloud SQL instance. Once connected, run a simple query such as:
SELECT * FROM Employees;
to confirm that your data has been restored.

Congratulations! You have successfully created a Cloud SQL instance, inserted sample data, generated a manual backup, restored that backup to a new instance, and verified that your data was preserved. This workflow demonstrates how Cloud SQL backups protect against accidental data loss and enable recovery in both test and production environments.