Using Control Plane's wormhole technology, network traffic is first routed through the wider internet, then to the targeted resource. If you have an extremely high traffic volume, this can cause egress fees to pile up quickly.
Native network resources save money on network egress, by keeping traffic within a cloud-provider's network.
All of the guides require:
- Terraform
- The CLI for the corresponding cloud provider, configured with proper access credentials.
While the infrastructure set up in this quick start is production-ready, Control Plane recommends that you choose an appropriate backend for terraform so that the state can be shared and re-used by your team.
Open a shell to the directory: vpc-endpoint-service-for-msk and run the create-infrastructure.sh script. E.g.
./manage-infrastructure.sh apply <your-msk-cluster-name-here> -r us-east-1 -b kafka.t3.small
The script will ask you to confirm the planned infrastructure additions twice, once for the cluster itself, and once for the networking configuration. After you confirm the MSK cluster you might want to grab a cup of coffee, because the process can take quite a while - up to 40 minutes in some cases.
- Get the bootstrap brokers using the AWS cli. Replace terraform-msk-0 in the command below with your chosen cluster
name.
Sample output:
aws kafka get-bootstrap-brokers --cluster-arn $(aws kafka list-clusters --query 'ClusterInfoList[?ClusterName == `terraform-msk-0`].ClusterArn | [0]' | tr -d '"')
Use the value of{ "BootstrapBrokerStringTls": "b-1.terraform-msk-0.c034on.c12.kafka.us-east-1.amazonaws.com:9094,b-2.terraform-msk-0.c034on.c12.kafka.us-east-1.amazonaws.com:9094,b-3.terraform-msk-0.c034on.c12.kafka.us-east-1.amazonaws.com:9094" }
BootstrapBrokerStringTls
in the commands listed below. - Use the AWS console to connect to the bastion host created by create-infrastructure.sh.
- Create a topic.
/opt/kafka/bin/kafka-topics.sh --topic _cpln_validate_ --bootstrap-server <BootstrapBrokerStringTls> --create --command-config $HOME/client.properties --replication-factor 3 --partitions 3
- Produce messages.
After you enter the command above, the script will await your input. Each time you press Return/Enter the script will write the text you typed to the topic.
/opt/kafka/bin/kafka-console-producer.sh --topic _cpln_validate_ --bootstrap-server <BootstrapBrokerStringTls> --producer.config $HOME/client.properties
- Consume messages.
You should see all of the messages you wrote in step 4. NOTE: the messages may not be in the same order. In Kafka message ordering is preserved within each partition, but not across the entire topic.
/opt/kafka/bin/kafka-console-consumer.sh --topic _cpln_validate_ --bootstrap-server <BootstrapBrokerStringTls> --from-beginning --consumer.config $HOME/client.properties
create-infrastructure.sh produces a t2.micro ec2 instance that allows for easy access to the MSK cluster via the Kafka CLI. If you wish, you can terminate this instance now. But unless you have another way to access the cluster for administrative purposes, Control Plane recommends that you leave the instance in place.
./manage-infrastructure.sh destroy <your-msk-cluster-name-here> -r us-east-1