Skip to main content

Connect to AlloyDB

You can connect your AlloyDB for PostgreSQL database and make it available as a resource in Retool. Once complete, your users can write queries that interact with RethinkDB data.


All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.

To create an AlloyDB resource, you need:

  • Authentication credentials for the AlloyDB database.
  • Connection details for the AlloyDB database host. This includes the hostname, port, and database name.
  • Firewall rules that allow Retool to access your AlloyDB host.

AlloyDB currently only supports network connectivity through private, internal IP addresses configured for private services access. To connect to your database from Retool Cloud, configure an AlloyDB Auth proxy on GCP, or use Retool's SSH connection option to go through a bastion host in your VPC.

1. Create a new resource

Sign in to your Retool organization and create a new AlloyDB resource.

2. Configure the resource

Provide the necessary details to configure the resource so Retool can connect to AlloyDB. Not all settings are required, but refer to the AlloyDB documentation to learn what is needed.


These settings configure the name and location of the resource within Retool.


The name to use for the resource (e.g., AlloyDB).


The folder in which to save the resource.


A brief description of the resource (e.g., User data).


These settings configure how Retool connects to AlloyDB.


The database hostname.


The database port.

Database name

The database name.

Database username

The name of the database user.

Database password

The password of the database user.


Enable this setting to connect over SSL/TLS. See the Connect SSL/TLS guide for details on the fields to configure.

Advanced options

You can also configure the following advanced settings for AlloyDB resources.

Disable converting queries to prepared statements

This disables SQL injection protection to allow dynamically generated SQL using JavaScript.

Show write GUI mode only

This restricts queries to GUI mode only and prevents users from writing raw SQL queries.

3. Save the resource

Click Create resource to complete the setup. You can then click either Create an app to immediately start building a Retool app or Back to resources to return to the list of resources.

Wrap up

Your AlloyDB resource is now ready to use. Because AlloyDB is fully compatible with PostgreSQL, the query editor for AlloyDB provides PostgreSQL syntax highlighting and auto-complete.