Skip to main content

How to Set up Amazon Redshift

Connect Amazon Redshift to Foundational: let Foundational reach your endpoint, enter the connection details, then download and run the generated script that creates the read-only user and its grants.

Setup takes 10 minutes.

Introduction

Connecting Amazon Redshift to Foundational lets Foundational scan your Redshift database and determine lineage and downstream impact for its tables, views, materialized views and stored procedures. Foundational also reads query history to show how tables are used and what they cost.

This works for both provisioned Redshift clusters and Redshift Serverless workgroups.

To make the connection, you need to:

  • Let Foundational reach your Redshift endpoint

  • Enter the connection details in Foundational and choose a user name and password for Foundational

  • Run the setup script Foundational generates, which creates that user and its grants


Prerequisites

Ensure you have:

  • A Redshift superuser

  • A SQL client connected to your Redshift database (for example the Redshift Query Editor v2 or psql)

  • Network access from Foundational to your Redshift endpoint (see the next section)


Access permissions

Foundational gets no access to the data in your tables. The user the script creates can read:

  • Table, view and column definitions, view and materialized-view SQL, and stored procedure source

  • Query history (the text of queries, who ran them, when, and which tables they touched)

  • Table sizes and row counts

  • Serverless compute usage (RPU-seconds), used to estimate cost

It gets these roles and grants, and nothing else:

  • GRANT ROLE sys:monitor: query history, table sizes and Serverless usage.

  • ALTER USER ... SYSLOG ACCESS UNRESTRICTED: the query history of all users, not only Foundational's own queries.

  • GRANT USAGE ON SCHEMA on every schema: the column list of late-binding views and the state of materialized views.


Let Foundational reach your Redshift endpoint

Foundational connects to Redshift on its endpoint port (5439 by default).

  1. Make the cluster or workgroup endpoint reachable from outside your VPC (Publicly accessible turned on), or contact us to discuss a private connection.

  2. In the security group attached to the cluster or workgroup, add an inbound rule for TCP on the endpoint port from each Foundational IP address. The addresses are listed in Allowing IP Access to Foundational.


Connect Foundational to Amazon Redshift

  1. In Foundational, open the Connectors & Integrations page.

  2. In Warehouses, select the Amazon Redshift card and click Connect.

  3. Click Add Database, then Start Setup.

  4. Enter the details:

    • Database Hostname: the endpoint host of your cluster or workgroup, without the port and database. For example my-cluster.abc123xyz.us-east-1.redshift.amazonaws.com or my-workgroup.123456789012.us-east-1.redshift-serverless.amazonaws.com.

    • Database Port: the endpoint port, 5439 unless you changed it.

    • Database Name: the database to scan, for example dev.

    • User Name: the user the script will create, for example foundational. Use lowercase letters, digits and underscores.

    • Password: a password of your choice for that user. Redshift passwords are 8 to 64 characters, must contain an uppercase letter, a lowercase letter and a number, and cannot contain spaces, quotes, \, / or @.

  5. Click Next, then Click to Download to get redshift_foundational_setup.sql.

  6. Connect to the database you entered as a superuser and run the script. It contains the password only as its MD5 hash, never in plain text.

  7. Back in Foundational, click Next, then Save.

That's it. Foundational is now connected to Amazon Redshift.


What the script runs

For the user name foundational, the script runs these statements. <password-md5-hash> is the MD5 hash Redshift accepts in place of the password.

CREATE USER foundational PASSWORD '<password-md5-hash>';
GRANT ROLE sys:monitor TO foundational;
ALTER USER foundational SYSLOG ACCESS UNRESTRICTED;-- A temporary procedure grants USAGE on every schema, then the script drops it.
CREATE OR REPLACE PROCEDURE public.foundational_grant_schema_usage() AS $$ ... $$ LANGUAGE plpgsql;
CALL public.foundational_grant_schema_usage();
DROP PROCEDURE public.foundational_grant_schema_usage();

Schemas you create later need their own grant:

GRANT USAGE ON SCHEMA <schema_name> TO foundational;
Did this answer your question?