Troubleshooting a Connection Issue with Cloud SQL

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

Sometimes, you may face connectivity issues with your Cloud SQL instance, and it’s important to know what to look for when troubleshooting. In this hands-on lab, we will discover a solution when troubleshooting a connection issue between a Compute Engine Instance and a Cloud SQL Instance.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Cloud SQL Instance
  1. From the main console navigation, head over to SQL.
  2. Click on CREATE INSTANCE.
  3. Then choose MySQL.
  4. Name the instance "test-connection-instance" and add the following settings:
    • Root password: "12345"
    • Database version: MySQL 5.7
    • Machine type: Standard (1 vCPU, 3.75 GB)
  5. Click Create.
Create a Compute Engine Instance
  1. From the main console navigation, head over to *Compute Engine**
  2. Click Create.
  3. Click on Allow HTTP. Then leave everything else as the default. The boot disk should be Debian.
  4. Click Create.
Enable the Cloud SQL Admin API
  1. From the main console navigation, head over to APIs and Services.
  2. Click on Enable APIs and Services.
  3. Then type in "Cloud SQL Admin API".
  4. Click Enable.
Add the Compute Engine Instance Public IP as a Authorized Network for Cloud SQL
  1. From the main console navigation, head over to Compute Engine.
  2. Then choose and copy the public IP for your instance.
  3. From the main console navigation, head over to SQL.
  4. Click on the test-connection-instance. Click on Edit, and then Connectivity.
  5. Click on Add network, paste the VM’s IP, and click Done.
  6. Click Save.
SSH into Your VM to Connect to Cloud SQL
  1. From the main console navigation, head over to Compute Engine.
  2. Click on SSH.
  3. Once connected, get and install updates.
  4. Connect to the instance by using the command.
  5. Use the password you set up for your instance.

You are now connected.

Additional Resources

Your team is having trouble connecting to the Cloud SQL instances in your project using the public IP. They have tasked you with troubleshooting the environment and fixing the problem.

In the end, your team should be able to connect successfully to a Cloud SQL instance in the teams project.

To complete this task you will need to:

  1. Try to connect with the Cloud SQL instance from our Compute Engine instance.

  2. Check to see if we can ping the IP address.

  3. Make sure that your IP address is an Authorized Network for the Cloud SQL network.

  4. Try to connect to the Cloud SQL instance again.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?