This will begin the process of deploying the required resources. You will automatically be redirected to the following screen
The deployment will take 5 - 10 minutes to complete. You can click on the refresh button and view the status of the deployment. The initial status will be CREATE_IN_PROGRESS
when the status is CREATE_COMPLETE
. Click on the Outputs section of the CloudFormation stack and copy the values of the output. The output values will be used in subsequent parts of this workshop.
Cloud9 and MSK from a network point of view, must be able to communicate with each other. To achieve this you must update the network security group for MSK to accept incoming traffic from the Cloud9 security group.
You will be redirected to the edit inbound rules page
The msk security group will now accept inbound network traffic originating from the cloud-9 security group
We need to create a topic in Kafka that we can later send log data to.
Kafka_OpenSearch_Anomaly_Detection/Kafka/1_create_topic.py
yes | sudo yum install java-1.8.0
in the Cloud9 terminalwget https://archive.apache.org/dist/kafka/2.6.2/kafka_2.12-2.6.2.tgz
tar -xzf kafka_2.12-2.6.2.tgz
cd kafka_2.12-2.6.2
bin/kafka-topics.sh --create --zookeeper <ZookeeperConnectString> --replication-factor 1 --partitions 1 --topic ApplicationMetricTopic
replace the <ZookeeperConnectString>
with the plaintext Apache ZooKeeper connection information you copied down on Step 4Run the updated command in the Cloud9 terminal
The command will return a result Created topic ApplicationMetricTopic
Before we can send data to OpenSearch we need to create an index. You will run a python script from Cloud9 that will create an index in the OpenSearch domain.
If you are not already in the Cloud9 console
If you are already in the Cloud9 console
Kafka_OpenSearch_Anomaly_Detection/OpenSearch/1_create_index.py
<opensearch_domain_endpoint_url>
with the value of the OSDomainURL key from the CloudFormation stack output and save the filecd ~
pip install requests
python environment/Kafka_OpenSearch_Anomaly_Detection/OpenSearch/1_create_index.py
Later in the lab when we upload data to OpenSearch the IAM role we will use needs access in OpenSearch. We can run a python script in Cloud9 map the IAM role to the OpenSearch role
If you are not already in the Cloud9 console
If you are already in the Cloud9 console
Kafka_OpenSearch_Anomaly_Detection/OpenSearch/2_map_IAM_user.py
<os_domain_url>
with the value of the OSDomainURL key from the CloudFormation stack output<IAM_user/role_arn>
with the value of the IAMUserARN key from the CloudFormation stack output and save the filepython environment/Kafka_OpenSearch_Anomaly_Detection/OpenSearch/2_map_IAM_user.py
Our AWS environment set up. When you are ready begin the next step Configure Lambda