Google Cloud SQL Connection

Connect ForceCnx to a Cloud SQL for PostgreSQL instance using the native Cloud SQL connector. No public IP required.

Prerequisites

Step 1: Create a Service Account

1

Create the service account

In the Google Cloud Console, go to IAM & Admin → Service Accounts and create a new service account for ForceCnx.

# Using gcloud CLI
gcloud iam service-accounts create forcecnx-reader \
  --display-name="ForceCnx Database Reader"
2

Grant Cloud SQL Client role

Assign the Cloud SQL Client role to the service account. This allows it to connect to Cloud SQL instances in the project.

gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:forcecnx-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/cloudsql.client"
3

Download the service account key

Create and download a JSON key file for the service account. You'll upload this to ForceCnx.

gcloud iam service-accounts keys create key.json \
  --iam-account=forcecnx-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com

Step 2: Configure IAM Database Authentication (Optional)

Recommended: IAM database authentication eliminates the need for a static database password. The service account authenticates directly to PostgreSQL using its GCP identity.

To use IAM auth, enable it on your Cloud SQL instance and create a database user mapped to the service account:

# Enable IAM authentication on the instance
gcloud sql instances patch YOUR_INSTANCE \
  --database-flags=cloudsql.iam_authentication=on

# Create an IAM database user
gcloud sql users create forcecnx-reader@YOUR_PROJECT_ID.iam \
  --instance=YOUR_INSTANCE \
  --type=CLOUD_IAM_SERVICE_ACCOUNT

Then grant the IAM user access to your tables:

-- Connect to your database and run:
GRANT USAGE ON SCHEMA public TO "forcecnx-reader@YOUR_PROJECT_ID.iam";
GRANT SELECT ON TABLE customers, orders TO "forcecnx-reader@YOUR_PROJECT_ID.iam";

Step 3: Create the Connection in ForceCnx

4

Open the New Connection form

From your ForceCnx Dashboard, click + New Connection and select the GCP Cloud SQL tab.

5

Enter connection details

Fill in your Cloud SQL connection parameters:

FieldDescriptionExample
Instance Connection NameFound on the Cloud SQL instance overview pagemy-project:us-central1:my-db
DatabaseDatabase namemyapp
UsernameDatabase user (or IAM user)forcecnx_reader
PasswordDatabase password (leave blank if using IAM auth)
Use IAM AuthEnable for IAM database authenticationChecked
Service Account JSONPaste the contents of your key.json file
6

Test and save

Click Create Connection. ForceCnx uses the Cloud SQL connector to establish a secure tunnel to your instance — no public IP or firewall rules needed.

How It Works

ForceCnx uses Google's Cloud SQL connector library to connect to your instance. This provides:

Security: Keep your service account key JSON secure. ForceCnx encrypts it at rest using AES-256-GCM, but you should also restrict access to the key in GCP and rotate it periodically.

Next Steps

Once connected, follow the Getting Started guide to map entities, configure field mappings, and set up Salesforce Connect.