Skip to main content
Amazon Redshift is a fully managed, petabyte-scale data warehouse service in the cloud. The RisingWave Redshift sink connector provides efficient data ingestion with support for automatic schema changes and both S3-based and direct loading methods.

Syntax

Parameters

S3 parameters These options only need to be set when with_s3 = true:

Auto schema change

PREMIUM FEATUREThis is a premium feature. For a comprehensive overview of all premium features and their usage, please see RisingWave premium features.
Redshift sinks support auto schema change to automatically adapt their output schema according to changes in the upstream table. This feature is always enabled and requires no additional configuration. When you add new columns to the source table, the sink will automatically update to match the new schema. This reduces manual intervention and makes your data pipelines more robust to schema evolution.

Configure RisingWave to write to S3

You need to configure how RisingWave authenticates with AWS S3. There are two primary methods:
  • Access Key / Secret Key (AK/SK) authentication
This is the default method. Provide your AWS Access Key ID and Secret Access Key directly in the CREATE SINK statement.
  • Assume role authentication
For enhanced security, RisingWave can assume an IAM Role in your AWS account to gain temporary credentials for S3 access.
To use this method, you need to configure an IAM Role in AWS that RisingWave can assume. This involves:
  1. Obtaining the RisingWave Cloud IAM role ARN (Workload Identity (IAM Role ARN)) from the Cloud metadata page in the Console (ConnectionCloud Meta tab).
  2. Creating an IAM policy with the necessary S3 read/write permissions for your bucket and prefix.
  3. Configuring the IAM Role’s trust policy to use the RisingWave Cloud IAM role ARN as the trusted principal.
For a complete step-by-step walkthrough, see Set up IAM role assume.

Append-only and upsert modes

Amazon Redshift sink connector supports both append-only and upsert modes for flexible data handling. In upsert mode, performance is optimized through the use of an intermediate table:
  • An intermediate table is created to stage data before merging it into the target table. If create_table_if_not_exists is set to true, the table is automatically named rw_<target_table_name>_<uuid>.
  • You can specify a different schema for the intermediate table using the intermediate.schema.name parameter. If not configured, the intermediate table will be created in the same schema as the target table. If the intermediate schema differs from the target schema, ensure the user has CREATE privilege on that schema (for example, GRANT CREATE ON SCHEMA [intermediate_schema_name] TO [username]).
  • Data is written to intermediate storage (S3) at intervals defined by write.intermediate.interval.seconds (default: 1800 seconds).
  • Data is periodically merged from the intermediate table into the target table according to the write.target.interval.seconds setting (default: 3600 seconds).
  • By default, an S3 bucket is required to achieve optimal ingestion performance into the intermediate table.
  • Alternatively, you can use INSERT SQL statements to load data directly into the intermediate table, though this approach is not recommended due to performance drawbacks.
Examples:
  1. Redshift sink with S3 writer (Append-only mode)
  1. Redshift sink with S3 writer (Upsert mode)

Set up Redshift

When configuring RisingWave to write to Redshift, the JDBC user must have appropriate permissions depending on whether the create_table_if_not_exists option is enabled.
  • If create_table_if_not_exists is not enabled, the user must have permissions on the target table:
These permissions allow RisingWave to read, insert, update, delete, and alter the existing table.
  • If create_table_if_not_exists is enabled, the user needs the table permissions above plus schema-level permissions to create new tables:
This ensures that RisingWave can create tables in the specified schema when they do not already exist.

Set up Redshift S3 integration

When using S3 as an intermediate storage for Redshift sinks, you need to configure assume role permissions so that RisingWave can write to the user’s S3 bucket.
  1. Permissions for the S3 account configured in RisingWave
The S3 account credentials used in RisingWave must have the following permissions on the target bucket/path:
These permissions allow RisingWave to read, list, write, and delete files in the staging S3 location.
  1. Permissions for Redshift to access the S3 account
Redshift itself also needs permissions to read from the same S3 bucket. Grant the following permissions to Redshift’s IAM role:
This allows Redshift to copy data from S3 into the Redshift table.

Set up S3 IAM and role

To guarantee that the IAM role has sufficient permissions to connect to Redshift and access AWS resources:
  1. Attach policy to the IAM Role
Attach the policy AmazonRedshiftAllCommandsFullAccess to the role.
  1. Configure trusted entities
In the IAM Role trust relationship, allow Redshift service to assume the role:
  1. Attach the IAM role to Redshift instance
  • Navigate to the Amazon Redshift service in the AWS Management Console.
  • In the left navigation pane, select Clusters and choose the cluster you want to configure.
  • From the Actions menu, select Manage IAM Roles, and attach the configured IAM role.