Redshift Profile

Overview of dbt-redshift

Maintained by: core dbt maintainers
Author: dbt Labs
Source: Github
Core version: v0.13.0 and newer
dbt Cloud: Supported
dbt Slack channel Link to channel

Authentication Methods

Password-based authentication

~/.dbt/profiles.yml
company-name:
target: dev
outputs:
dev:
type: redshift
host: hostname.region.redshift.amazonaws.com
user: username
password: password1
port: 5439
dbname: analytics
schema: analytics
threads: 4
keepalives_idle: 0 # default 0, indicating the system default
connect_timeout: 10 # default 10 seconds
# search_path: public # optional, not recommended
sslmode: [optional, set the sslmode used to connect to the database (in case this parameter is set, will look for ca in ~/.postgresql/root.crt)]
ra3: true # enables cross-database sources

IAM Authentication

To set up a Redshift profile using IAM Authentication, set the method parameter to iam as shown below. Note that a password is not required when using IAM Authentication. For more information on this type of authentication, consult the Redshift Documentation and boto3 docs on generating user credentials with IAM Auth.

If you receive the "You must specify a region" error when using IAM Authentication, then your aws credentials are likely misconfigured. Try running aws configure to set up AWS access keys, and pick a default region. If you have any questions, please refer to the official AWS documentation on Configuration and credential file settings.

~/.dbt/profiles.yml
my-redshift-db:
target: dev
outputs:
dev:
type: redshift
method: iam
cluster_id: [cluster_id]
host: hostname.region.redshift.amazonaws.com
user: alice
iam_profile: data_engineer # optional
iam_duration_seconds: 900 # optional
autocreate: true # optional
db_groups: ['analysts'] # optional
# Other Redshift configs:
port: 5439
dbname: analytics
schema: analytics
threads: 4
keepalives_idle: 0 # default 0, indicating the system default
# search_path: public # optional, but not recommended
sslmode: [optional, set the sslmode used to connect to the database (in case this parameter is set, will look for ca in ~/.postgresql/root.crt)]
ra3: true # enables cross-database sources

Specifying an IAM Profile

New in dbt v0.18.0

The iam_profile config option for Redshift profiles is new in dbt v0.18.0

When the iam_profile configuration is set, dbt will use the specified profile from your ~/.aws/config file instead of using the profile name default

Redshift notes

Where possible, dbt enables the use of sort and dist keys. See the section on Redshift specific configurations.