Amazon Redshift Sink Connector for Confluent Cloud

Note

If you are installing the connector locally for Confluent Platform, see Amazon Redshift Sink Connector for Confluent Platform.

The Kafka Connect Amazon Redshift Sink connector for Confluent Cloud allows you to export Avro, JSON Schema, or Protobuf data from Apache Kafka® topics to Amazon Redshift. The connector polls data from Kafka and writes this data to an Amazon Redshift database. Polling data is based on subscribed topics. Auto-creation of tables and limited auto-evolution are supported.

Important

If you are still on Confluent Cloud Enterprise, please contact your Confluent Account Executive for more information about using this connector.

Features

  • The Amazon Redshift Sink connector inserts Kafka records into an Amazon Redshift database.
  • The connector supports Avro, JSON Schema, or Protobuf input data formats. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).
  • auto.create and auto-evolve are supported. If tables or columns are missing, they can be created automatically.
  • There is no primary key support.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Refer to Cloud connector limitations for additional information.

Quick Start

Use this quick start to get up and running with the Confluent Cloud Amazon Redshift Sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to Amazon Redshift.

Prerequsites
  • Authorized access to a Confluent Cloud cluster on Amazon Web Services.
  • The Confluent Cloud CLI installed and configured for the cluster. See Install and Configure the Confluent Cloud CLI.
  • Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).
  • The Amazon Redshift database must be in the same region as your Confluent Cloud cluster.
  • Public inbound traffic access (0.0.0.0/0) must be allowed to the VPC where the database is located, unless the environment is configured for VPC peering.
  • The connector configuration requires a Redshift user (and password) with Redshift database INSERT and ALTER privileges. See the following AWS documentation for more information:
  • Kafka cluster credentials. You can use one of the following ways to get credentials:
    • Create a Confluent Cloud API key and secret. To create a key and secret, go to Kafka API keys in your cluster or you can autogenerate the API key and secret directly in the UI when setting up the connector.
    • Create a Confluent Cloud service account for the connector.

Using the Confluent Cloud GUI

Step 1: Launch your Confluent Cloud cluster.

See the Quick Start for Apache Kafka using Confluent Cloud for installation instructions.

Step 2: Add a connector.

Click Connectors. If you already have connectors in your cluster, click Add connector.

Step 3: Select your connector.

Click the Amazon Redshift Sink connector icon.

Amazon Redshift Sink Connector Icon

Step 4: Set up the connection.

Note

  • Make sure you have all your prerequisites completed.
  • An asterisk ( * ) designates a required entry.

Complete the following and click Continue.

  1. Select one or more topics.
  2. Enter a Connector Name.
  3. Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.
  4. Select an Input message format (data coming from the Kafka topic): AVRO, JSON_SR (JSON Schema), or PROTOBUF. A valid schema must be available in Schema Registry to use a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).
  5. Provide Redshift database connection information. For more information, see Getting Started with Amazon Redshift. Note the following:
    • In a Redshift cluster there is a single leader node. The Redshift Domain is the domain where the cluster leader is located. This is entered as a domain path. For example: redshift-cluster-1.cf3bzixkdiebh.us-east-1.redshift.amazonaws.com.
    • The default Redshift Port is port 5439.
  6. Enter the Redshift database details. Note the following:
    • Providing a Table name format is optional and defaults to the name of the Kafka topic. To create a table name format use the syntax ${topic}. For example, to create a table named kafka-orders based on a Kafka topic named orders, you would enter kafka-${topic} in this field.
    • The Database timezone defaults to UTC.
  7. Enter the Batch size. This is how many records to attempt to batch together. A typical value to use here is 3000 records.
  8. Select whether the connector automatically creates a table or columns if they are missing relative to the input record schema.
  9. Enter the number of tasks for the connector. See Confluent Cloud connector limitations for additional task information.

Configuration properties that are not shown in the Confluent Cloud UI use the default values. For default values and property definitions, see Amazon Redshift Sink Connector Configuration Properties.

Step 5: Launch the connector.

Verify the connection details and click Launch.

Launch the connector

Step 6: Check the connector status.

The status for the connector should go from Provisioning to Running.

Step 7: Check the results in Redshift.

  1. From the AWS Management Console, go to your Redshift project.
  2. Verify that new records are being added to the database.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See Dead Letter Queue for details.

For additional information about this connector, see Amazon Redshift Sink Connector for Confluent Platform. Note that not all Confluent Platform connector features are provided in the Confluent Cloud connector.

See also

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent Cloud CLI to manage your resources in Confluent Cloud.

../_images/topology.png

Using the Confluent Cloud CLI

Complete the following steps to set up and run the connector using the Confluent Cloud CLI.

Note

Make sure you have all your prerequisites completed.

Step 1: List the available connectors.

Enter the following command to list available connectors:

ccloud connector-catalog list

Step 2: Show the required connector configuration properties.

Enter the following command to show the required connector properties:

ccloud connector-catalog describe <connector-catalog-name>

For example:

ccloud connector-catalog describe RedshiftSink

Example output:

Following are the required configs:
connector.class: RedshiftSink
name
kafka.api.key
kafka.api.secret
topics
input.data.format
aws.redshift.domain
aws.redshift.user
aws.redshift.password
aws.redshift.database
tasks.max

Step 3: Create the connector configuration file.

Create a JSON file that contains the connector configuration properties. The following example shows required and optional connector properties.

{
    "name": "redshift-sink-connector",
    "connector.class": "RedshiftSink",
    "kafka.api.key": "<my-kafka-api-key>",
    "kafka.api.secret": "<my-kafka-api-secret>",
    "topics": "<topic-name>",
    "input.data.format": "AVRO",
    "aws.redshift.domain": "<cluster-leader-path>",
    "aws.redshift.port": "5439",
    "aws.redshift.user": "<redshift-username>",
    "aws.redshift.password": "<redshift-user-password>",
    "aws.redshift.database": "<redshift-database-name>",
    "db.timezone": "UTC",
    "auto.create": "true",
    "auto.evolve": "true",
    "tasks.max": "1"
}

Note the following property definitions:

  • "name": Sets a name for your new connector.
  • "connector.class": Identifies the connector plugin name.
  • "topics": Identifies the topic name or a comma-separated list of topic names.
  • "input.data.format": Sets the input message format (data coming from the Kafka topic). Valid entries are AVRO, JSON_SR, or PROTOBUF. You must have Confluent Cloud Schema Registry configured if using a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).
  • aws.redshift.domain: This is the domain path to the cluster leader node. For example: redshift-cluster-1.cf3bzixkdiebh.us-east-1.redshift.amazonaws.com.
  • "db.timesone": (Optional) The timezone for the datbase. Defaults to UTC. For a list of valid entries, see tz datbase time zones.
  • "auto.create" (tables) and "auto-evolve" (columns): (Optional) Sets whether to automatically create tables or columns if they are missing relative to the input record schema. If not entered in the configuration, both default to "false".
  • "tasks.max": Maximum number of tasks the connector can run. See Confluent Cloud connector limitations for additional task information.

Configuration properties that are not listed use the default values. For default values and property definitions, see Amazon Redshift Sink Connector Configuration Properties.

Step 4: Load the configuration file and create the connector.

Enter the following command to load the configuration and start the connector:

ccloud connector create --config <file-name>.json

For example:

ccloud connector create --config redshift-sink-config.json

Example output:

Created connector redshift-sink-connector lcc-ix4dl

Step 5: Check the connector status.

Enter the following command to check the connector status:

ccloud connector list

Example output:

ID          |       Name              | Status  | Type
+-----------+-------------------------+---------+------+
lcc-ix4dl   | redshift-sink-connector | RUNNING | sink

Step 6: Check the results in Redshift.

  1. From the AWS Management Console, go to your Redshift project.
  2. Verify that new records are being added to the database.

You can manage your full-service connector using the Confluent Cloud API. For details, see the Confluent Cloud API documentation.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See Dead Letter Queue for details.

For additional information about this connector, see Amazon Redshift Sink Connector for Confluent Platform. Note that not all Confluent Platform connector features are provided in the Confluent Cloud connector.

Next Steps

See also

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent Cloud CLI to manage your resources in Confluent Cloud.

../_images/topology.png