Skip to content

Latest commit

 

History

History
87 lines (59 loc) · 2.49 KB

File metadata and controls

87 lines (59 loc) · 2.49 KB

Camel-Kafka-connector AWS2 IAM Sink for deleting user

This is an example for Camel-Kafka-connector AWS2-IAM Sink for deleting user

Standalone

What is needed

  • An AWS Account

  • An existing user in AWS IAM

Running Kafka

$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 tar.gz and extract the content to a directory. In this example we’ll use /home/oscerd/connectors/

> cd /home/oscerd/connectors/
> wget https://repo1.maven.org/maven2/org/apache/camel/kafkaconnector/camel-aws2-iam-kafka-connector/0.9.0/camel-aws2-iam-kafka-connector-0.9.0-package.tar.gz
> untar.gz camel-aws2-iam-kafka-connector-0.9.0-package.tar.gz

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:

...
plugin.path=/home/oscerd/connectors
...

Setup the connectors

Open the AWS2 IAM configuration file at $EXAMPLES/aws2-iam/aws2-iam-sink-delete-user/config/CamelAWS2IAMSinkConnector.properties

name=CamelAWS2IAMSinkConnector
connector.class=org.apache.camel.kafkaconnector.aws2iam.CamelAws2iamSinkConnector
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter

topics=mytopic

camel.sink.path.label=iam-point

camel.component.aws2-iam.operation=deleteUser

camel.component.aws2-iam.accessKey=<accessKey>
camel.component.aws2-iam.secretKey=<secretKey>
camel.component.aws2-iam.region=aws-global

and add the correct credentials for AWS.

Running the example

Run the kafka connect with the IAM Sink connector:

$KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties $EXAMPLES/aws2-iam/aws2-iam-sink-delete-user/config/CamelAWS2IAMSinkConnector.properties

You’ll need to have the Camel user created in AWS IAM.

On a different terminal run the kafkacat producer and send the following message

> echo "Test1" | ./kafkacat -b localhost:9092 -t mytopic -H "CamelHeader.CamelAwsIAMUsername=Camel"

On your AWS IAM console, you should see Camel user deleted.