Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconconfluent-oss-ami
file-type-iconconfig
file-type-iconssl
file-type-iconREADME.md
file-type-iconcheck-for-kafka-trust-store.sh
file-type-iconcheck-for-key-store.sh
file-type-iconconfigure-common-dependencies.sh
file-type-iconconfigure-kafka-connect.sh
file-type-iconconfigure-kafka-rest.sh
file-type-iconconfigure-schema-registry.sh
file-type-iconconfluent-oss.json
file-type-iconkafka-ami
file-type-iconkafka-zookeeper-confluent-oss-ami
file-type-iconkafka-zookeeper-confluent-oss-colocated-cl...
file-type-iconkafka-zookeeper-confluent-oss-standalone-c...
file-type-iconkafka-zookeeper-standalone-clusters
file-type-iconzookeeper-ami
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
file-type-iconterraform-cloud-enterprise-private-module-...

Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconconfluent-oss-ami
file-type-iconconfig
file-type-iconssl
file-type-iconREADME.md
file-type-iconcheck-for-kafka-trust-store.sh
file-type-iconcheck-for-key-store.sh
file-type-iconconfigure-common-dependencies.sh
file-type-iconconfigure-kafka-connect.sh
file-type-iconconfigure-kafka-rest.sh
file-type-iconconfigure-schema-registry.sh
file-type-iconconfluent-oss.json
file-type-iconkafka-ami
file-type-iconkafka-zookeeper-confluent-oss-ami
file-type-iconkafka-zookeeper-confluent-oss-colocated-cl...
file-type-iconkafka-zookeeper-confluent-oss-standalone-c...
file-type-iconkafka-zookeeper-standalone-clusters
file-type-iconzookeeper-ami
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
file-type-iconterraform-cloud-enterprise-private-module-...
Apache Kafka and Confluent Tools

Apache Kafka and Confluent Tools

Deploy a cluster of Kafka brokers. Optionally deploy Confluent tools such as Schema Registry, REST Proxy, and Kafka Connect.

Code Preview

Preview the Code

mobile file icon

README.md

down

Confluent Open Source Tools Example AMI

This folder contains an example Packer template that can be used to create an Amazon Machine Image (AMI) with open source Confluent Tools, including Schema Registry and REST Proxy. A few notes about this Packer template:

  • It builds two AMIs, one on top of Amazon Linux and one on top of Ubuntu. Pick whichever distro you prefer.

  • This AMI includes examples of how to configure Schema Registry and REST Proxy with SSL support. It expects you to use the generate-key-stores module to generate a Key Store and Trust Store before building the AMI.

  • This AMI only includes Schema Registry and REST Proxy. It does not include ZooKeeper, Kafka, or Kafka Connect, which are expected to be running in one or more separate clusters, launched from separate AMIs (see the zookeeper-ami example and kafka-ami example). For an example of all services co-located in the same cluster, see kafka-zookeeper-confluent-ami.

To deploy this AMI, see the kafka-zookeeper-standalone-clusters example.

Quick start

To build the AMI:

  1. Run the generate-key-stores module to create a Key Store, Trust Store, and self-signed SSL certificate for each of Schema Registry, REST Proxy, and the Kafka Connect workers. You can run the check-for-xxx-key-store.sh scripts to print out example usage for the generate-key-stores.sh script. For additional information on this step, see [Generating SSL Certificates](#generating-ssl-certificates] below.

  2. Copy the Trust Store you created for the kafka-ami to the confluent-oss-ami/ssl/kafka folder. We'll use this to enable Schema Registry, REST Proxy, and Kafka Connect to connect via SSL to Kafka.

  3. Install Packer.

  4. Set up your AWS credentials as environment variables.

  5. Set the GITHUB_OAUTH_TOKEN environment variable to a valid GitHub auth token with "repo" access. You can generate one here: https://github.com/settings/tokens

  6. Run packer build -var "package_kafka_branch=<branch>" -only <target os> confluent-oss.json to create a new AMI in your AWS account. Note down the ID of this new AMI.

To deploy the new AMI, plug its ID into the kafka-zookeeper-standalone-clusters example.

Generating SSL Certificates

The number of possible interactions between all the tools in the Confluent Platform makes understanding the various SSL certificates needed for a "secure" Confluent setup potentially confusing. This section aims to clear that up.

Terminology

  • Key Store: A file that contains SSL certificates a given service presents to others. It contains both a public certificate that the server presents to clients and a corresponding private key that the server uses to prove that it is the identity presented by the public certificate. This file is generated by the keytool program that comes bundled with the JDK. TL;DR: The Key Store contains the certs a given service presents to others.

  • Trust Store: A file that contains the public certificate of the Certificate Authority (CA) used to sign public certificates used by other servers. Services use the Trust Store to know which public certificates they trust when making an SSL connection. This file is generated by the keytool program that comes bundled with the JDK. TL;DR: The Trust Store contains the certs a given server will trust from others.

Instructions

The steps to generate the right SSL certificate are straightforward. Here are some guidelines to follow:

  1. All SSL certificates should be generated using the generate-key-stores module.

  2. Kafka brokers should receive their own Key Store and Trust STore. Schema Registry, REST Proxy, and Kafka Connect may share the same Key Store and Trust Store, although some users may wish to create a separate Key Store/Trust Store for each of these services. Check out the check-for-xxx-key-store.sh scripts in this folder to see additional details about generating SSL certificates for each service.

    Note that you will use the same Kafka broker SSL certificates in both the Kafka broker AMI and other AMIs. That's because supporting tools like Schema Registry and REST Proxy need the Trust Store file you generated when you created the Kafka SSL certificates.

  3. Now place all your SSL files in the following folder structure in this Packer template folder:

    - confluent-oss-ami
      - ssl
        - kafka
          - truststore.jks
        - kafka-connect
          - keystore.jks
          - truststore.jks (optional)
        - kafka-rest
          - keystore.jks
          - truststore.jks (optional)
        - kafka-rest
           - keystore.jks
           - truststore.jks (optional) 
    

    If you are re-using the same set of SSL files, feel free to copy the same file into different file paths. This makes it explicit exactly where each Key Store and/or Trust Store file comes from.

Inspecting SSL Certificate Files

If you want to examine an existing SSL certificate file to see what information it contains, run the following command:

openssl x509 -in /path/to/cert/file -text

Note that this will only work on the cert and ca-cert files, not on the Key Store and Trust Store files, which are unique to Java. To view those, you can use an open source tool like Keystore Explorer.

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?