# PostgreSQL

## 1. How to connect to PostgreSQL?

Acho allows you to connect to any PostgreSQL database (Self-hosted, GCP Cloud SQL, AWS PostgreSQL, AWS Aurora...). You can follow the steps below to set up the connection.

1\. Go to the **Resources** page and click the **Add Resource** button.

2\. In the "Select a data source" step, select **PostgreSQL** under the **Database** tab.

3\. In the "Configure the data source" step, enter your database login credentials.

* `host`: either a `hostname` or an `IP address` depending on where you host your PostgreSQL database
* `port`
* `DB Name`
* `User`
* `Password`

{% hint style="info" %}
&#x20;Note: remember to add Acho's IP address, **`35.239.14.244`**, to your [whitelist](#3.-how-to-add-achos-ip-into-your-whitelist) before starting the connection.
{% endhint %}

4\. In the "Select the tables", choose tables that you want to import.

5\. Click **Finish Setup**. You will see a  <img src="https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MgBh5PshcmRFk38itib%2F-MgBo4LSmdK4OS-NqLZy%2Fsyncing.png?alt=media&#x26;token=452494f9-e4be-48fa-9644-bee7d969c46c" alt="" data-size="line"> icon next to your PostgreSQL resource. It may take a few minutes to several hours depending on the data size and the number of your tables. Once your APP's data is ready, you will receive a notification email.&#x20;

## 2. How to set up Data Sync?

Acho supports creating schedulers to retrieve the latest data from your database at a certain time interval. To see more details, you can visit [here](https://docs.acho.io/data-sync/untitled).

## 3. How to add Acho's IP into your whitelist?

You should whitelist our service IP address **`35.239.14.244`** . This way we can make a connection to your database and import the tables to **Acho Studio**. Here is how you can whitelist Acho's service IP address for your database instance.

### **Example 1: Whitelist for Cloud SQL on GCP (Google Cloud Platform)**

1. Click on your database instance and then navigate to the **Connections** page
2. Check the **Public IP** checkbox.
3. Click **Add network** , and enter **`35.239.14.244`**(If you need to input an IP range, just enter **`35.239.14.244`**).
4. Click **Done** and **Save**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MjpWH5X6Wuz2FkyyTck%2F-Mjpph5hGYz6hmAUW6k8%2Fimage.png?alt=media\&token=80648366-6ad8-4d26-a6a6-1189c67cd7da)

### **Example 2: Whitelist for RDS or MySQL on AWS (Amazon Web Services)**

1\. Go to **Network & Securtiy** and make sure your database instance can connect to our service as shown below.

![img](https://gblobscdn.gitbook.com/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MHEB0JPVdUtjpRlAtjx%2F-MHHX-TM9Aia1h5yd6Vb%2FScreen%20Shot%202020-09-15%20at%2011.44.15%20AM.png?alt=media\&token=f5619f9c-5b7e-4b94-a146-2a691fc5649d)

2\. Click on the **Security Groups** and add an **Inbound Rule** to allow our service to connect to your database as shown below.
