# Ensuring Secure Cloud SQL Connections with SSL Certificate

Providing the database's SSL certificate when connecting to Cloud SQL is essential to verify the server's identity and prevent man-in-the-middle (MITM) attacks. Without specifying the certificate, the client cannot be sure it is connecting to the intended server, leaving the connection vulnerable to interception by malicious actors. By supplying the SSL certificate, the client can authenticate the server's identity, ensuring that the data exchange happens only with the legitimate database server. This verification step adds a critical layer of trust and security in database connections.

### 1. Identify Your Cloud SQL Instance Configuration

**Access the Google Cloud Console:**

* Log in to the Google Cloud Console and navigate to the **SQL** service
* Select your target database instance from the list&#x20;

<figure><img src="/files/knzjXmyr14WNX0edY8em" alt=""><figcaption></figcaption></figure>

**Determine Instance Details:**

* Click on the instance name to open the instance details page
* Note your database engine type (PostgreSQL, MySQL, or SQL Server)

<figure><img src="/files/kJO73aEXzp7R47AZhkuB" alt=""><figcaption></figcaption></figure>

### 2. Download the SSL Certificate

**Navigate to Certificate Management:**

* Click on the **Connections** tab
* Click on the **Security** tab
* Locate the **Manage certificates** area

<figure><img src="/files/PuCMjii6vRwxpIdqLlhl" alt=""><figcaption></figcaption></figure>

**Download the Server Certificate:**

* Click **Download Certificates** to get the Certificate Authority (CA) certificate
* The downloaded file will be named `server-ca.pem`
* Save this file securely as you'll need to upload it to Stacksync

<figure><img src="/files/Zz2r2btOGpVxLxCXSxES" alt=""><figcaption></figcaption></figure>

### 3. Upload the SSL Certificate to Stacksync

When creating a new database connection in the Stacksync app, upload the downloaded SSL certificate to complete the secure configuration.

<figure><img src="/files/gZ5rXGKZazsIaCVLgD3B" alt=""><figcaption></figcaption></figure>

***

If you have any questions or need further assistance, reach out to us at <hello@stacksync.com>. We're here to help ensure a seamless and secure database connection setup.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stacksync.com/two-way-sync/connectors/postgres/authorize-postgres/cloud-sql/ensuring-secure-cloud-sql-connections-with-ssl-certificate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
