Skip to main content

Connecting to VMs or databases in Google Cloud using Private Service Connect

This topic describes how to connect to VMs or databases in Google Cloud using Private Service Connect:

Connecting to a VM instance serving as a database

You can publish the VM instance serving as the database and generate the service attachment to that VM instance.

To connect to a VM instance serving as a database:

  1. Install a VM instance (vm-mysql) with MySQL Server.

  2. Make sure the VM is accessible as a database by adding firewall rules.

  3. Publish the VM by creating the backend service and service attachment.

  4. Create another VM (test-vm) in the same region where the VM serving as the database resides.

  5. Create a Private Service Connect endpoint in the VM VPC by consuming the VM serving as the database's service attachment.

  6. Use the IP of the private service connect from the VM (test-vm) to access the database.

    For example, create an application in Striim Cloud where you configure the private endpoint as the target and the cloud database as the source.

Connecting to cloud SQL databases managed by Google Cloud Platform

You can create a VM which has private service access to a cloud SQL database (Google Cloud Platform managed service). You can publish the VM instance and create a service attachment to that VM instance.

To connect to cloud SQL databases including MySQL or Postgres managed by Google Cloud Platform:

  1. Create a cloud MySQL (cloud-sql) DB instance.

  2. Create private service access to the cloud MySQL instance.

  3. Create a VM (vm-cloud-sql) in same region and project of the cloud SQL instance.

  4. Add iptable rules in the VM to redirect TCP traffic to the database.

  5. Publish the VM by creating the backend service and service attachment.

  6. Create another VM (test-vm) in the same region where the VM serving as the database (vm-cloud-sql) resides.

  7. Create a Private Service Connect endpoint in the VM VPC by consuming the VM peered with the cloud MySQL database's service attachment.

  8. Use the IP of the private service connect from the VM (test-vm) to access the database.

    For example, create an application in Striim Cloud where you configure the private endpoint as the target and the cloud database as the source.

Connecting to Google Spanner

You can create a private service connect which has access to all the Google Cloud Platform APIs.

  1. Create a Google spanner instance (gs-db) that you can accessed through Google APIs from the remote host.

  2. Create a Private Service Connect endpoint in a VM (test-vm) VPC to access all the Google APIs.

  3. Use the URL to test access to the Google Spanner instance.

    For example, create an application in Striim Cloud where you configure Google Spanner as the target and MySQL as the source.

Connecting to Google BigQuery

You can create a private service connect which has access to all the Google Cloud Platform APIs.

To connect to BigQuery:

  1. Create a Google BigQuery instance which you can access though Google-managed APIs from a remote host.

  2. Create private service connect in a VM (test-vm) VPC to access the Google APIs.

  3. Test access to the Google BigQuery instance.