Database Connection
Connect a PowerSync Cloud instance to your backend database.
Create PowerSync Instance
In the PowerSync dashboard project tree (PowerSync Cloud), click on "Create new instance":
![](https://docs.powersync.com/~gitbook/image?url=https%3A%2F%2F3476836279-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FV9geAO9ITPi8WOYK5o0r%252Fuploads%252FBiYeP2i5cr2Gl9nWl1RR%252FScreenshot%25202023-08-11%2520at%25202.01.23%2520PM.png%3Falt%3Dmedia%26token%3Daf9b935c-947c-4b2d-a2a4-ec6be71cb5e9&width=768&dpr=4&quality=100&sign=98ee8cc5&sv=1)
Give your instance a name, such as "Todolist Testing".
Under the "General" tab, you can change the default cloud region from "US" to "EU" or "JP" if desired (more cloud regions are available, contact us if you need a different region).
Under the "DB Connections" tab, click on the + icon.
Each provider has their quirks when it comes to specifying connection details, so we have documented provider-specific instructions below.
Connect PowerSync to Database
Select your provider for steps to connect your database to the newly created instance:
Supabase
Get your connection details from Supabase:
In your Supabase dashboard, navigate to "Project Settings" -> "Database" -> "Connection string" and select the "URI" tab.
Uncheck the "Display connection pooler" checkbox. PowerSync needs to connect to the database directly and cannot use the pooler.
Copy the connection string. The hostname should be
db.<PROJECT-ID>.supabase.co
, and not, for example,aws-0-us-west-1.pooler.supabase.com
.Paste this URI into the connection URI field.
Enter the password for the
postgres
user in your Supabase databaseSupabase also refers to this password as the database password or project password.
PowerSync has the Supabase CA certificate pre-configured —
verify-full
SSL mode can be used directly, without any custom certificates.If you want to query your database via the PowerSync dashboard, enable "Allow querying in the editor?".
Click "Test Connection" and fix any errors.
Under the "Client Auth" tab, enable "Use Supabase Auth".
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Troubleshooting
Supabase is configured with a maximum of 4 logical replication slots, with one often used for Supabase Realtime.
It is therefore easy to run out of replication slots, resulting in an error such as "All replication slots are in use" when deploying. To resolve this, delete inactive replication slots by running this query:
select slot_name, pg_drop_replication_slot(slot_name) from pg_replication_slots where active = false;
AWS RDS
Locate the connection details from RDS:
Copy the "Endpoint" value.
Paste the endpoint into the "Host" field.
Complete the remaining fields: "Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can paste a connection string into the "URI" field to simplify this.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.PowerSync has the AWS RDS CA certificate pre-configured —
verify-full
SSL mode can be used directly, without any additional configuration required.If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Troubleshooting
If you get an error such as "IPs in this range are not supported", the instance is likely not configured to be publicly accessible. A DNS lookup on the host should give a public IP, and not for example 10.x.x.x or 172.31.x.x.
Azure Postgres
Fill in your connection details from Azure.
"Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can also paste a connection string into the "URI" field to simplify data entry.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.PowerSync has the Azure CA certificate pre-configured —
verify-full
SSL mode can be used directly, without any additional configuration required.If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
If you encounter the error
"must be superuser or replication role to start walsender"
, ensure that you've followed all the steps for enabling logical replication documented here.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Google Cloud SQL
Fill in your connection details from Google Cloud SQL.
"Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can paste a connection string into the "URI" field to simplify data entry.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.The server certificate can be downloaded from Google Cloud SQL.
If SSL is enforced, a client certificate and key must also be created on Google Cloud SQL, and configured on the PowerSync instance.
If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Neon
Fill in your connection details from Neon.
"Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can paste a connection string into the "URI" field to simplify data entry.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.Note that if you're using a self-signed SSL certificate for your database server, click the "Download Certificate" button to dynamically fetch the recommended certificate directly from your server.
Also note if you get any error such as
server certificate not trusted: SELF_SIGNED_CERT_IN_CHAIN
, click "Download Certificate" to attempt automatic resolution.If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Fly Postgres
Fill in your connection details from Fly Postgres.
"Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can paste a connection string into the "URI" field to simplify data entry.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.Note that if you're using a self-signed SSL certificate for your database server, click the "Download Certificate" button to dynamically fetch the recommended certificate directly from your server.
Also note if you get any error such as
server certificate not trusted: SELF_SIGNED_CERT_IN_CHAIN
, click "Download Certificate" to attempt automatic resolution.If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
For other providers and self-hosted databases:
Other / Self-hosted
Fill in your connection details.
"Name", "Host", "Port", "Database name", "Username", "Password" and "SSL Mode" are required. You can paste a connection string into the "URI" field to simplify data entry.
"Name" can be any name for the connection.
"Port" is 5432 for Postgres databases.
"Username" and "Password" maps to the
powersync_role
created in Source Database Setup.Note that if you're using a self-signed SSL certificate for your database server, click the "Download Certificate" button to dynamically fetch the recommended certificate directly from your server.
Also note if you get any error such as
server certificate not trusted: SELF_SIGNED_CERT_IN_CHAIN
, click "Download Certificate" to attempt automatic resolution.If you want to query your source database via the PowerSync dashboard, enable "Allow querying data from the dashboard?".
Click "Test Connection" and fix any errors.
Click "Save".
PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.
Last updated