Bird
Raised Fist0
GCPcloud~20 mins

Backup and restore in GCP - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Backup and Restore Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
1:30remaining
Understanding Cloud SQL Automated Backups

What happens when you enable automated backups on a Cloud SQL instance in Google Cloud?

ACloud SQL requires manual initiation of backups; automated backups are not supported.
BCloud SQL creates backups only when a user triggers a failover event.
CBackups are created only when the instance is stopped and restarted.
DCloud SQL creates daily backups and retains them for a user-defined retention period automatically.
Attempts:
2 left
💡 Hint

Think about how automated backups help with data protection without manual intervention.

❓ Architecture
intermediate
1:30remaining
Designing Backup Strategy for Compute Engine VM

You want to back up a Compute Engine VM's disk regularly with minimal downtime. Which approach is best?

ACreate snapshots of the VM's persistent disk while the VM is running.
BCreate a new VM and copy the disk contents to it for backup.
CCopy all files manually from the VM to Cloud Storage using a cron job.
DStop the VM, create a disk image, then restart the VM.
Attempts:
2 left
💡 Hint

Consider how snapshots work with running disks and downtime.

❓ security
advanced
2:00remaining
Securing Backup Data in Cloud Storage

You store backups in a Cloud Storage bucket. What is the best practice to ensure backup data is protected from unauthorized access?

AUse bucket-level IAM roles to restrict access and enable Object Versioning for recovery.
BMake the bucket public so backups can be accessed from anywhere if needed.
CDisable all encryption to improve backup speed and reduce costs.
DShare the bucket credentials with all team members for easy access.
Attempts:
2 left
💡 Hint

Think about controlling access and protecting data integrity.

❓ Configuration
advanced
2:00remaining
Restoring a Cloud SQL Instance from Backup

You need to restore a Cloud SQL instance to a point in time 3 hours ago. Which method should you use?

ADelete the instance and create a new one with the same name.
BUse Point-in-Time Recovery (PITR) feature to restore the instance to 3 hours ago.
CManually download the backup and upload it to a new instance.
DRestore from the latest automated backup only; PITR is not supported.
Attempts:
2 left
💡 Hint

Consider features that allow restoring to a specific time.

✅ Best Practice
expert
2:30remaining
Optimizing Backup Storage Costs for Large Datasets

Your backups are growing large and costly in Cloud Storage. Which strategy best reduces storage costs while keeping backups reliable?

ADelete all backups older than one day to save space.
BKeep all backups in Standard storage indefinitely for fastest access.
CUse lifecycle management to transition older backups to Coldline or Archive storage classes automatically.
DStore backups on local disks of Compute Engine instances instead of Cloud Storage.
Attempts:
2 left
💡 Hint

Think about balancing cost and data availability over time.

Practice

(1/5)
1. What is the main purpose of creating a backup in Google Cloud SQL?
easy
A. To save a copy of your database data safely for recovery
B. To increase the speed of your database queries
C. To permanently delete old data from your database
D. To automatically update your database schema

Solution

  1. Step 1: Understand backup purpose

    Backups are copies of data saved to protect against data loss.
  2. Step 2: Identify backup use in Cloud SQL

    In Cloud SQL, backups allow restoring data if something goes wrong.
  3. Final Answer:

    To save a copy of your database data safely for recovery -> Option A
  4. Quick Check:

    Backup = Safe data copy [OK]
Hint: Backup means saving data safely for later recovery [OK]
Common Mistakes:
  • Confusing backup with performance improvement
  • Thinking backup deletes data
  • Assuming backup changes database structure
2. Which gcloud command correctly creates an on-demand backup for a Cloud SQL instance named my-instance?
easy
A. gcloud sql backup create --name=my-instance
B. gcloud sql instances backup create my-instance
C. gcloud sql backups create --instance=my-instance
D. gcloud sql create backup --instance=my-instance

Solution

  1. Step 1: Recall correct gcloud backup syntax

    The correct command to create a backup is gcloud sql backups create --instance=INSTANCE_NAME.
  2. Step 2: Match command to instance name

    Replacing INSTANCE_NAME with my-instance gives the correct command.
  3. Final Answer:

    gcloud sql backups create --instance=my-instance -> Option C
  4. Quick Check:

    Backup command = gcloud sql backups create [OK]
Hint: Use 'gcloud sql backups create --instance=NAME' to backup [OK]
Common Mistakes:
  • Using 'instances backup' instead of 'backups create'
  • Incorrect flag names like --name instead of --instance
  • Wrong command order or missing 'create'
3. Given this command output snippet after restoring a Cloud SQL backup:
Restoring backup 2024-06-01_12-00 to instance my-instance... DONE

What does this output indicate?
medium
A. The backup was successfully restored to the instance
B. The backup creation failed
C. The instance was deleted
D. The backup is scheduled for later restoration

Solution

  1. Step 1: Read the command output carefully

    The message says 'Restoring backup ... DONE', indicating completion.
  2. Step 2: Understand the meaning of 'DONE'

    'DONE' means the restore process finished successfully.
  3. Final Answer:

    The backup was successfully restored to the instance -> Option A
  4. Quick Check:

    Restore output 'DONE' = success [OK]
Hint: Look for 'DONE' to confirm successful restore [OK]
Common Mistakes:
  • Confusing restore success with backup failure
  • Assuming instance deletion from restore message
  • Thinking restore is scheduled, not completed
4. You run the command gcloud sql backups create --instance=my-instance but get an error: ERROR: (gcloud.sql.backups.create) The instance does not support on-demand backups.
What is the most likely cause?
medium
A. You typed the instance name incorrectly
B. The Cloud SQL instance is a First Generation instance which does not support on-demand backups
C. You need to enable billing on your Google Cloud project
D. The backup command requires a different flag for on-demand backups

Solution

  1. Step 1: Understand error message about backup support

    The error says the instance does not support on-demand backups.
  2. Step 2: Recall Cloud SQL instance generations

    First Generation instances do not support on-demand backups; only Second Generation and later do.
  3. Final Answer:

    The Cloud SQL instance is a First Generation instance which does not support on-demand backups -> Option B
  4. Quick Check:

    First Gen instances lack on-demand backup support [OK]
Hint: Check instance generation; First Gen lacks on-demand backups [OK]
Common Mistakes:
  • Assuming typo in instance name causes this error
  • Thinking billing is the cause
  • Believing backup flag is incorrect
5. You want to restore a Cloud SQL instance prod-db to a previous state using a backup from June 1, 2024. Which sequence of steps correctly achieves this with minimal downtime?
hard
A. Restore the backup directly to the current instance while it is serving traffic
B. Delete the current instance, then restore the backup to the same instance name immediately
C. Export the backup to Cloud Storage, then import it back to the instance
D. Create a new instance from the backup, then switch your application to use the new instance

Solution

  1. Step 1: Understand restore options for minimal downtime

    Restoring directly to a live instance causes downtime; better to create a new instance.
  2. Step 2: Create new instance from backup and switch traffic

    Create a new instance restored from backup, then update your app to use it, minimizing downtime.
  3. Final Answer:

    Create a new instance from the backup, then switch your application to use the new instance -> Option D
  4. Quick Check:

    New instance restore + switch = minimal downtime [OK]
Hint: Restore to new instance, then switch app to avoid downtime [OK]
Common Mistakes:
  • Deleting instance before restore causing data loss
  • Restoring live instance causing service interruption
  • Using export/import which is slower and more complex
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard