Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

🧑‍💻 AWS Foundation Sale - Certified Cloud & AI Practitioner Mock Exams for only $12.99 each!

Back to Course

GCP PlayCloud Labs

0% Complete
0/0 Steps
  1. GCP PlayCloud Labs
  2. Guided Lab: How to Launch a GCP Compute Engine Linux Instance
  3. Guided Lab: Creating a VM Using Instance Templates
  4. Guided Lab: Creating and Managing Instance Groups in Compute Engine
  5. Guided Lab: Creating a Spot VM Instance
  6. Guided Lab: Configuring Shielded VM Options
  7. Guided Lab: Exploring Instance Metadata in Google Cloud
  8. Guided Lab: Vertically Scaling a VM Instance
  9. Guided Lab: Setting up a Web Server on a VM Instance
  10. Guided Lab: Using Startup Scripts in GCP VM Instances
  11. Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
  12. Guided Lab: Creating VM Snapshots and Restoring a VM from a Snapshot
  13. Guided Lab: Setting Up and Managing a Database on a VM Instance
  14. Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
  15. Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
  16. Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
  17. Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
  18. Guided Lab: Guarding Your VM with Deletion Protection
  19. Guided Lab: Setting Up a Linux Bastion Host on GCP
  20. Guided Lab: Creating a Cloud Storage Bucket
  21. Guided Lab: Uploading, Organizing, and Managing Objects in Cloud Storage
  22. Guided Lab: Exploring Google Cloud Storage Classes
  23. Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
  24. Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
  25. Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
  26. Guided Lab: Managing Cloud Storage Buckets via SSH Commands
  27. Guided Lab: Creating a Cloud SQL Instance
  28. Guided Lab: Running SQL Commands in Cloud SQL Studio
  29. Guided Lab: Creating and Restoring Cloud SQL Backups
  30. Guided Lab: Integrating Cloud SQL Database instance with a VM instance
  31. Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
  32. Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
  33. Guided Lab: Creating a Cloud NAT Gateway
  34. Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
  35. Guided Lab: Connecting to a Kubernetes Engine Cluster
  36. Guided Lab: Deploying a Simple Web Application on GKE
  37. Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
  38. Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
  39. Guided Lab: Configuring Firewall Rules to Secure and Access a VM
  40. Guided Lab: Creating an Application Load Balancer
  41. Guided Lab: Creating a Network Load Balancer
Lesson 29 of 41
In Progress

Guided Lab: Creating and Restoring Cloud SQL Backups

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.

Skip to content