Rituraj kumar
Rituraj kumar

Reputation: 356

Is it possible to connect to the private IP of a Cloud SQL instance in GCP Vertex AI pipeline?

I am working on a pipeline to perform data transformation of data residing on GCP cloud SQL with private IP on a different project by using the Vertex AI pipeline. I am not able to get any documents regarding connecting to Cloud SQL in it. Does anyone have any idea how to connect Cloud SQL with Private IP to the Vertex AI pipeline?

Upvotes: 4

Views: 1641

Answers (2)

FakeFootball
FakeFootball

Reputation: 477

I implemented something similar using the AI Platform. Relevant post here: How can I grant AI Platform training jobs access to Cloud SQL resources in the same project?

  1. Use the Google provide custom Cloud SQL connector in your code.
  2. Create a service account with the appropriate permissions including Cloud SQL Client. Permissions requirements under service account here.
  3. Launch the job using the api. The code in the above linked post would need to be modified. Use the Vertex AI job create function and replace Platform AI job with the vertex AI customJob.

Upvotes: 1

kurtisvg
kurtisvg

Reputation: 3565

This was also asked on the Cloud SQL Auth proxy repo. Adding the answer here for posterity:

I've never used Vertex AI, but from a quick scan of the docs, I see there's support for VPC network peering.

So, roughly (and without having tried this myself), the steps would be:

  1. Configure a VPC network peering between Vertex AI and your VPC that hosts the private IP instance
  2. Assuming you're running a custom container, you could:
  • either start the proxy as a background process and connect to it,
  • or if you're using one of the languages supported by the proxy connectors (i.e., Go, Java, and Python), you could dial directly to your DB with that connector.

Upvotes: 2

Related Questions