This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector-examples.git
The following commit(s) were added to refs/heads/master by this push: new cb79afe Added AWS2-Kms example with scheduled deletion of a key cb79afe is described below commit cb79afe05ac1e8394c3d472a0bd15afa4c79e6ef Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Thu Feb 4 14:51:17 2021 +0100 Added AWS2-Kms example with scheduled deletion of a key --- aws2-kms/aws2-kms-sink-delete-key/README.adoc | 84 ++++++++++++++++++++++ .../config/CamelAWS2KMSSinkConnector.properties | 31 ++++++++ 2 files changed, 115 insertions(+) diff --git a/aws2-kms/aws2-kms-sink-delete-key/README.adoc b/aws2-kms/aws2-kms-sink-delete-key/README.adoc new file mode 100644 index 0000000..c935259 --- /dev/null +++ b/aws2-kms/aws2-kms-sink-delete-key/README.adoc @@ -0,0 +1,84 @@ += Camel-Kafka-connector AWS2 KMS Sink for deleting a key + +This is an example for Camel-Kafka-connector AWS2-KMS Sink for deleting a key + +== Standalone + +=== What is needed + +- An AWS Account + +=== Running Kafka + +[source] +---- +$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties +$KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties +$KAFKA_HOME/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic mytopic +---- + +=== Download the connector package + +Download the connector package zip and extract the content to a directory. In this example we'll use `/home/oscerd/connectors/` + +[source] +---- +> cd /home/oscerd/connectors/ +> wget https://repo1.maven.org/maven2/org/apache/camel/kafkaconnector/camel-aws2-kms-kafka-connector/0.7.1/camel-aws2-kms-kafka-connector-0.7.1-package.zip +> unzip camel-aws2-kms-kafka-connector-0.7.1-package.zip +---- + +=== Configuring Kafka Connect + +You'll need to set up the `plugin.path` property in your kafka + +Open the `$KAFKA_HOME/config/connect-standalone.properties` and set the `plugin.path` property to your choosen location: + +[source] +---- +... +plugin.path=/home/oscerd/connectors +... +---- + +=== Setup the connectors + +Open the AWS2 KMS configuration file at `$EXAMPLES/aws2-kms/aws2-kms-sink-delete-key/config/CamelAWS2KMSSinkConnector.properties` + +[source] +---- +name=CamelAWS2KMSSinkConnector +connector.class=org.apache.camel.kafkaconnector.aws2kms.CamelAws2kmsSinkConnector +key.converter=org.apache.kafka.connect.storage.StringConverter +value.converter=org.apache.kafka.connect.storage.StringConverter + +topics=mytopic + +camel.sink.path.label=kms-point + +camel.component.aws2-kms.operation=scheduleKeyDeletion + +camel.component.aws2-kms.accessKey=<accessKey> +camel.component.aws2-kms.secretKey=<secretKey> +camel.component.aws2-kms.region=<region> +---- + +and add the correct credentials for AWS. + +=== Running the example + +Run the kafka connect with the KMS Sink connector: + +[source] +---- +$KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties $EXAMPLES/aws2-kms/aws2-kms-sink-delete-key/config/CamelAWS2KMSSinkConnector.properties +---- + +On a different terminal run the kafkacat producer and send the following message + +[source] +---- +> echo "Test1" | ./kafkacat -b localhost:9092 -t mytopic -H "CamelHeader.CamelAwsKMSKeyId=<id>" +---- + +On your AWS KMS console, you should see the key related to id scheduled for deletion. diff --git a/aws2-kms/aws2-kms-sink-delete-key/config/CamelAWS2KMSSinkConnector.properties b/aws2-kms/aws2-kms-sink-delete-key/config/CamelAWS2KMSSinkConnector.properties new file mode 100644 index 0000000..12d74b8 --- /dev/null +++ b/aws2-kms/aws2-kms-sink-delete-key/config/CamelAWS2KMSSinkConnector.properties @@ -0,0 +1,31 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name=CamelAWS2KMSSinkConnector +connector.class=org.apache.camel.kafkaconnector.aws2kms.CamelAws2kmsSinkConnector +key.converter=org.apache.kafka.connect.storage.StringConverter +value.converter=org.apache.kafka.connect.storage.StringConverter + +topics=mytopic + +camel.sink.path.label=kms-point + +camel.component.aws2-kms.operation=scheduleKeyDeletion + +camel.component.aws2-kms.accessKey=<accessKey> +camel.component.aws2-kms.secretKey=<secretKey> +camel.component.aws2-kms.region=<region>