> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Redshift

DirectQuery Redshift connector is using [Redshift JDBC driver](https://docs.aws.amazon.com/redshift/latest/mgmt/jdbc20-install.html)
to connect to a database.

## User and Role

To connect DirectQuery to Redshift, you will first need a User linked to a Role with sufficient privileges.\
You can perform these following actions with a Redshift 'power user' account.

### Create a Role

This [reference](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_ROLE.html) can help you to create a Role.

### Grant required privileges to this Role

DirectQuery required privileges are:

* `USAGE` privilege on target schema
* `SELECT` privilege on schema queryable objects (tables, views)

This [reference](https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html) will help you to grant these to your new role.

### Create a User linked to this Role

Last step is to create a User with the following attributes:

* login
* password

For more help on this step you may refer to user management help [section](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html).

And then assign the role to the user with a `GRANT ROLE` command.

## Basic authentication connection

Connection is done through [DirectQuery Redshift connector](../../directquery/getting_started#create-the-database-connector) passing the minimal following properties:

* [JDBC connection string](https://docs.aws.amazon.com/redshift/latest/mgmt/jdbc20-obtain-url.html)
* password

## Authentication connection with AWS IAM credentials

After configuring AWS, the credentials are usually stored into the file `~/.aws/credentials`.
If the location is different, it can be set with the `AWS_CREDENTIAL_PROFILES_FILE` environment variable.

The AWS user needs the AWS permissions `redshift:DescribeClusters` and `redshift:GetClusterCredentials`.

Then you only need to provide the connection string, which will start with the following `jdbc:redshift:iam://`.

For more details, check the [AWS documentation](https://docs.aws.amazon.com/redshift/latest/mgmt/generating-iam-credentials-configure-jdbc-odbc.html).
