Google Cloud Storage Sink Connector for Confluent Cloud

Note

If you are installing the connector locally for Confluent Platform, see Google Cloud Storage Sink Connector for Confluent Platform.

The Kafka Connect Google Cloud Storage (GCS) connector, currently available as a sink, allows you to export data from Apache Kafka® topics to GCS objects in various formats. Additionally, for certain data layouts, the GCS connector exports data by guaranteeing exactly-once delivery semantics to consumers of the GCS objects it produces.

The GCS connector is the counterpart of the S3 cloud storage sink connector in Google Cloud.

Features

The Confluent Cloud Google Cloud Storage (GCS) sink connector provides the following features:

  • Exactly Once Delivery: Records that are exported using a deterministic partitioner are delivered with exactly-once semantics regardless of the eventual consistency of GCS.
  • Data Format with or without Schema: Out of the box, the connector supports writing data to GCS in Avro, JSON, and Bytes. Schema validation is disabled for JSON.
  • Schema Evolution: schema.compatibility is set to NONE.
  • Partitioner: The connector supports the TimeBasedPartitioner class based on the Kafka class TimeStamp.
  • Flush size: flush.size defaults to 1000. For example, if you use the default setting of 1000 and your topic has six partitions, files start to be created in the storage bucket after more than 1000 records exist in each partition. Note that the default value of 1000 can be increased if needed.

Refer to Cloud connector limitations for additional information.

Quick Start

Use this quick start to get up and running with the Confluent Cloud GCS sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to a GCS bucket.

Prerequisites
  • Authorized access to a Confluent Cloud cluster on GCP.

  • The Confluent Cloud CLI installed and configured for the cluster. See Install and Configure the Confluent Cloud CLI.

  • A GCP GCS bucket in the same region as your Confluent Cloud cluster.

  • A GCP service account. You download the service account key pair as a JSON file. You upload this JSON file when creating the GCS connector.

    Important

    Your GCP service account role must have permission to create new objects in the GCS bucket. For example, the Storage Admin role can be selected for this purpose. If you are concerned about security and do not want to use the Storage Admin role, only use the storage.objects.get and storage.objects.create roles. Also, note that the Storage Object Admin role does not work for this purpose.

  • Either one of the following to use for the Kafka cluster credentials fields:

    • A Confluent Cloud API key and secret. After you have created your cluster, go to Cluster settings > API access > Create Key.
    • A Confluent Cloud service account.

Step 1: Launch your Confluent Cloud cluster.

See the Confluent Cloud Quick Start for installation instructions.

Step 2: Add a connector.

Click Connectors > Add connector.

../../_images/ccloud-add-connector.png

Step 3: Select your connector.

Click the Google Cloud Storage Sink connector icon.

Step 4: Enter the connector details.

Note

Make sure you have all your prerequisites completed.

Complete the following and click Continue.

  1. Enter a Connector Name.

  2. Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.

  3. Enter one or more Topic names. Separate multiple topic names with a comma.

    ../../_images/ccloud-gcs-details.png

Step 5: Enter the destination details.

Complete the following and click Continue.

Important

Your GCP credentials and bucket name are validated here. Make sure you enter these correctly.

  1. Upload the JSON file you downloaded earlier. The downloaded JSON file contains your GCP service account credentials.

  2. Enter the GCS bucket name.

  3. Select the message format.

  4. Select the Time interval that sets how you want your messages grouped in the GCS bucket. For example, if you select Hourly, messages are grouped into folders for each hour data is streamed to the bucket.

  5. Enter the Flush size. This value defaults to 1000. For example, if you use the default setting of 1000 and your topic has six partitions, files start to be created in the storage bucket after more than 1000 records exist in each partition. Note that the default value of 1000 can be increased if needed.

  6. Enter the number of tasks in use by the connector. Do not enter a value that exceeds the Max number displayed.

    ../../_images/ccloud-gcp-bucket-destination.png

Step 6: Launch the connector.

Verify the following and click Launch.

  • Make sure your data is going to the correct bucket.

  • Check that the last directory in the path shown is using the Time Interval you entered earlier.

    ../../_images/ccloud-gcp-launch-connector.png

Step 7: Check the connector status.

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

../../_images/ccloud-gcp-status.png

Step 8: Check the GCS bucket.

  1. Go to the the bucket Objects page for your GCS bucket.

  2. Open your topic folder and each subsequent folder until you see your messages displayed.

    ../../_images/ccloud-gcp-bucket-details.png

For additional information about the GCS connector see Google Cloud Storage Sink Connector for Confluent Platform. Note that not all Confluent Platform GCS connector features are provided in the Confluent Cloud GCS connector.

Next Steps

Try out a Confluent Cloud demo. Use the Confluent Cloud GCS sink connector and a GCS bucket to store data.