Amazon Redshift

Updated at:

Before you scan an Amazon Redshift cluster, create a read-only user with the required permissions and configure the data source connection.

Service account authorization

-- 1. Create a read-only user. If the user already exists, skip this step.
CREATE USER <username> PASSWORD 'your_password';

-- 2. Grant the database connection permission.
GRANT CONNECT ON DATABASE <your_database> TO <username>;

-- 3. Grant the USAGE permission on the target schema. Grant this permission only for the schema you want to discover.
-- Replace <schema_name> with the name of the schema you want to discover.
GRANT USAGE ON SCHEMA <schema_name> TO <username>;

-- 4. Grant the SELECT permission on all tables in the schema. This is required only for metadata discovery.
-- SVV views filter results based on the user's access permissions for the tables.
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <username>;

-- 5. If you have foreign tables (Redshift Spectrum), grant permissions on the external schema.
-- Replace <external_schema_name> with the name of your external schema.
GRANT USAGE ON SCHEMA <external_schema_name> TO <username>;
GRANT SELECT ON ALL TABLES IN SCHEMA <external_schema_name> TO <username>;

Data source management

Option

Description

--jdbc-url

JDBC connection URL (Required)

--username

Username (Required)

--password

Password (Required)

lhm datasource set RedShift -n RedShift1 \
    --jdbc-url jdbc:redshift://<host>:5439/<dev> \
    --username <username> \
    --password '$DB_PASSWORD'