Amazon Redshift is the world's fastest cloud data warehouse. It allows you to handle large analytical workloads with best-in-class performance, speed, and efficiency. With Redshift, you don't have to worry about the scale of your data or the cost of running queries on them.

Refer to the Warehouse Schema guide for more information on how the events are mapped to the tables in Redshift.
Find the open source code for this destination in the GitHub repository.

Setting up a Redshift cluster

Before adding Redshift as a destination in RudderStack, it is recommended that you create a new Redshift cluster depending on the type of instance needed.

The following sections contain step-by-step instructions on setting up a Redshift cluster.

Choosing the Redshift instance type

Amazon Redshift provides two types of clusters: Dense Compute and Dense Storage clusters.

  • Dense Compute clusters maximize CPU usage, resulting in an increased query performance. However, there is a trade-off with respect to the storage.
  • Dense Storage clusters maximize storage for customers with hundreds of millions of rows of data. However, there is a trade-off in the CPU usage, resulting in a lower query performance.
Refer to this Redshift guide for more information on the cluster and node types in Redshift.

Creating a new Redshift cluster

Follow the steps below to create a new Redshift cluster:

  1. Open the Redshift Console as shown:
Redshift Console Redshift Console
  1. Click the Create Cluster option, as shown:
Create Cluster
  1. Enter the cluster details. First, fill in the Cluster identifier and choose the instance type, as shown:
Cluster Identifier Redshift cluster configuration settings
  1. Enter the number of nodes for your cluster. This will primarily depend on the amount of data you expect to work with.
Enter the number of nodes
  1. Enter the database name, and create the admin user with the name of your choice.
Add Source
For security purposes, it is recommended that you choose a strong password.
  1. Finish creating the cluster by allowing the default options for Additional Configurations.
As a part of this setup, you also need to edit the VPC network and configure the security settings. More information on these aspects in available in the following sections.

With the Redshift cluster now created and ready to use, the next sections cover the necessary steps to set up the necessary user permissions and set up Redshift as a destination in RudderStack.

Setting user permissions in Redshift

This section contains the steps to create a new user to access the Redshift cluster and create temporary tables in it.

The username and password provided earlier while creating the Redshift cluster should be strictly used for administration purposes. RudderStack will create a different user to enable access to Redshift. This also helps RudderStack keep the queries separate as well as maintain an audit log.
  1. Click the Editor option in the left pane. You can run the queries to create a new user to access the Redshift cluster in the Query editor, as shown:
Query editor
  1. The queries to create a new user are listed below:
-- create a user named "rudder" RudderStack can use to access Redshift
CREATE USER rudder PASSWORD '<password goes here>';
-- granting schema creation permission to the "rudder" user on the database you chose earlier
GRANT CREATE ON DATABASE "<database name goes here>" TO "rudder";
  1. Log into the Redshift cluster with the newly created user credentials.
Use the newly-created user credentials while configuring Redshift as a destination in the RudderStack dashboard.

Setting up network and security access

This section is listed for EC2-VPC. However, EC2-Classic works similarly.

IPs to be allowlisted

To enable network access to RudderStack, allowlist the following RudderStack IPs depending on your region and RudderStack Cloud plan:

Plan
Region
US
EU
Free, Starter, and Growth
  • 23.20.96.9
  • 18.214.35.254
  • 52.38.160.231
  • 34.211.241.254
  • 18.198.90.215
  • 18.196.167.201
Enterprise
  • 34.198.90.241
  • 54.147.40.62
  • 3.216.35.97
  • 100.20.239.77
  • 44.236.60.231
  • 3.66.99.198
  • 3.64.201.167
All the outbound traffic is routed through these RudderStack IPs.

Adding a security group

Follow these steps to add a security group and assign it to your Redshift cluster:

  1. Go to EC2 from the services on your AWS console, as shown:
Go to EC2
  1. Go to Security Groups under Network & Security, followed by Create Security Group.
Create Security Group
  1. Enter the details of the security group. The Security group name will be used to select the group later.
Security group name
  1. Add an Inbound rule with IPs listed above, and enter the Redshift port as 5439 in the Port range field, as shown:
Port range
  1. Next, go to the Redshift cluster and select Properties, where you can modify the network and security rules of the cluster.
Properties
  1. Edit the Network and security option and choose the VPC security group that you selected earlier.
Network and security
  1. Finally, click Modify cluster to finish the Network and Security setup.
Modify cluster
The Redshift cluster needs to be publicly accessible. Refer to this Redshift guide for more information on how to set this property.

Configuring Redshift destination in RudderStack

To send event data to Redshift, you first need to add it as a destination in RudderStack and connect it to your data source. Once the destination is enabled, events will automatically start flowing to Redshift via RudderStack.

To configure Redshift as a destination in RudderStack, follow these steps:

  1. In your RudderStack dashboard, set up the data source. Then, select Redshift from the list of destinations.
  2. Assign a name to your destination and then click Next.

Connection settings

  • Host: The host name of your Redshift service.
  • Port: The port number associated with the Redshift database instance.
  • Database: The database name in your Redshift instance where the data will be sent.
  • User: The name of the user with the required read/write access to the above database.
  • Password: The password for the above user.
  • Namespace: Enter the schema name where RudderStack will create all the tables. If you don't specify any namespace, RudderStack will set this to the source name, by default.

SSH connection

This feature is available only for the Growth and Enterprise plan users.

SSH tunneling is a method of transferring data over an encrypted SSH connection. You can use it to add encryption to your legacy applications and achieve compliance with regulations like HIPAA, PCI-DSS, etc., without having to modify the existing applications.

RudderStack lets you connect to your Redshift database securely over an SSH connection by configuring these settings:

Redshift edit configuration
  • SSH Connection: Enable this setting to use the SSH connection while connecting to your Redshift database.
  • SSH Host: Enter the IP address of your bastion host.
  • SSH Port: Enter the port for the above host.
  • SSH User: Enter the username you use to access the bastion host.
  • SSH Public Key: Copy the public key provided in this field and add it to the authorized_keys file on your bastion host. Rudderstack will use the private key corresponding to this public key to establish the connection successully.

To enable the SSH connection for an existing Redshift destination, navigate to the destination's Configuration tab, select Edit configuration and enable the SSH connection setting.

Sync settings

  • Sync Frequency: Specify how often RudderStack should sync the data to your Redshift database.
  • Sync Starting At: This optional setting lets you specify the particular time of the day (in UTC) when you want RudderStack to sync the data to the warehouse.
  • Exclude Window: This optional setting lets you set a time window when RudderStack will not sync the data to your database.
  • JSON Columns: Use this optional setting to specify the required JSON column paths in dot notation, separated by commas. This option applies to all the incoming track events for this destination.
With the JSON columns feature, you can now ingest semi-structured event data not defined by a fixed schema. For more information on this feature, refer to the JSON Column Support guide.

Configuring the object storage

RudderStack lets you configure the following object storage configuration settings while setting up your Azure Synapse destination:

  • Use RudderStack-managed object storage: Enable this setting to use RudderStack-managed buckets for object storage.
This option is applicable only for RudderStack-hosted data planes. For self-hosted data planes, you will have to specify your own object storage configuration settings.

S3 Permissions

The alternative to providing AWS credentials for S3 access, is to set up permissions for your bucket as specified in the following section:

RudderStack-hosted data plane

You need to edit your bucket policy to allow RudderStack to write to your bucket with the following JSON:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::422074288268:user/s3-copy"
},
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::YOUR_BUCKET_NAME/*",
"arn:aws:s3:::YOUR_BUCKET_NAME"
]
}
]
}

Self-hosted data plane

  1. Create an IAM policy with the following JSON:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "arn:aws:s3:::*"
}
]
}
  1. Create an IAM user with programmatic access keys and attach the above created IAM policy. Copy the ARN of this user.
  2. Edit your bucket policy to allow the data plane to write to your bucket with the following JSON. Make sure you edit the account id and user ARN with your AWS Account ID and the above created user ARN:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::ACCOUNT_ID:user/USER_ARN"
},
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::YOUR_BUCKET_NAME/*",
"arn:aws:s3:::YOUR_BUCKET_NAME"
]
}
]
}
  1. Finally, add the programmatic access credentials to the environment of your data plane, as shown:
RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID=<above created user access key>
RUDDER_AWS_S3_COPY_USER_ACCESS_KEY=<above created user access key secret>

Column compression encoding

Compression encoding specifies the type of compression applied to a column of data values as rows are added to a table.

If not specified, Redshift automatically assigns compression encoding. RudderStack explicitly sets the runlength encoding for Boolean columns.

FAQ

How are reserved words handled by RudderStack?

There are some limitations when it comes to using reserved words in a schema, table, or column names. If such words are used in event names, traits or properties, they will be prefixed with a _when RudderStack creates tables or columns for them in your schema.

Besides, integers are not allowed at the start of the schema or table name. Hence, such schema, column or table names will be prefixed with a _.

For instance, '25dollarpurchase' will be changed to '_25dollarpurchase'.

For a more comprehensive FAQ list, refer to the Warehouse FAQ guide.

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.