Connecting to an Cloud SQL running in the private subnet of GCP VPC to your DevBox.
Follow the Connecting to GCP guide.
Go to Cloud SQL > Instances and note down the Internal IP Address of the instance.
Go to VPC network > Routes and select the region where you have deployed the instance.
Copy the Destination IP Range of the Peering Subnet route which contains the IP address of the Cloud SQL Instance.
SSH into your Bastion Host and enter the following command:
Go to DevBox.
Connecting to the Database.
Run the following commands:
To install the mysql client cli:
To access the database:
To install the psql client cli:
To access the database:
Go to Cloud SQL > Create an instance.
Use one of the database Engine in the Configuration.
Choose the Available Versions of the Database.
Enter your Instance ID and Password.
Go to Choose region and zonal availability and select the zone where you have provisioned your Private Subnet.
Scroll down to Customize your instance > Connections and choose Private IP only.
Enter your VPC when prompted.
Click on create a private service access connection and select Use automatically assigned IP range while choosing Allocated IP range.
Click on Create Instance.
Go to Cloud SQL > Instances and note down the Internal IP Address of the instance.
Go to VPC network > Routes and select the region where you have deployed the instance.
Copy the Destination IP Range of the Peering Subnet route which contains the IP address of the Cloud SQL Instance.
SSH into your Bastion Host and enter the following command:
Go to DevBox.
Connecting to the Database.
Run the following commands:
To install the mysql client cli:
To access the database:
To install the psql client cli:
To access the database: