# Ensuring Secure RDS Connections with SSL Certificate

Providing the database's SSL certificate when connecting to the RDS database is important 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 the SSL Certificate used by your RDS

1. **Access the AWS Console:**
   * Log in to the AWS Management Console and navigate to the RDS service.
   * Select the target database instance.
2. **Determine Certificate Details:**
   * Identify the Certificate Authority (CA) your database uses.
   * Confirm the AWS Region where your database is hosted.

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

### 2. Download the SSL Certificate

1. **Download from AWS Documentation:**
   * Visit the [AWS RDS SSL Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#:~:text=host%20your%20database.-,Certificate%20bundles%20by%20AWS%20Region,-The%20certificate%20bundles) and locate the appropriate certificate bundle based on your database’s region (e.g., `eu-west-3`).

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

2. **Extract the Correct Key:**

* The downloaded certificate file includes three keys for supported encryption methods: `rsa2048`, `rsa4096`, and `ecc384`.
* Use a text editor like VSCode to open the file.
* Select the appropriate certificate based on your database’s encryption method:
  * **Shortest key:** `ecc384`
  * **Longest key:** `rsa4096` (commonly used for enterprise-grade databases).

### Upload the SSL certificate to Stacksync

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

<figure><img src="/files/g0qLkfJ8mNPI0gXZigov" 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/amazon-rds/ensuring-secure-rds-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.
