To use an external Postgres database via CloudSQL ...
# replication-ask-ai
k
To use an external Postgres database via CloudSQL with Airbyte, you need to modify the environment variables in the
.env
file and allow inbound traffic from Airbyte IPs in your Cloud SQL settings. Here are the steps: 1. Modify the
.env
file:
You need to edit the following environment variables declared in the
.env
file:
Copy code
bash DATABASE_USER=postgres   DATABASE_PASSWORD=password   DATABASE_HOST=host.docker.internal # refers to localhost of host   DATABASE_PORT=3000   DATABASE_DB=postgres
If you want to separate the Config Database from the Job Database, you can specify separate parameters like this:
Copy code
bash CONFIG_DATABASE_USER=airbyte_config_db_user   CONFIG_DATABASE_PASSWORD=password
You also need to redefine the JDBC URL in the
DATABASE_URL
environment variable to include the correct host, port, and database. If you need to provide extra arguments to the JDBC driver (for example, to handle SSL) you should add it here as well:
Copy code
bash DATABASE_URL=jdbc:<postgresql://host.docker.internal:3000/postgres?ssl=true&sslmode=require>
If the config database is separate from the job database, you should also define `CONFIG_DATABASE_URL`:
Copy code
bash CONFIG_DATABASE_URL=jdbc:postgresql://<host>:<port>/<database>?<extra-parameters>
2. Allow inbound traffic from Airbyte IPs: If you are on Airbyte Cloud, you need to modify your database configuration to allow inbound traffic from Airbyte IPs. You can find a list of all IPs that need to be allowlisted in the [Airbyte Security docs](https://docs.airbyte.com/operator-guides/security#network-security-1). Please note that the actual values for the environment variables and the JDBC URLs will depend on your specific Postgres instance and network configuration. Sources: [Configuring the Airbyte Database](https://docs.airbyte.com/operator-guides/configuring-airbyte-db), [Postgres Source](https://docs.airbyte.com/integrations/sources/postgres), [Cloud SQL for PostgreSQL](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres)