Go back to the AWS Cloud9 console. Click on MSKClient-Cloud9EC2Bastion.
Click on Open IDE (or go back to the browser tab if already open).
You should be connected to the KafkaClientEC2Instance instance.
Go to the /tmp/kafka/integration-sample-lambda-msk directory and run the cleanup.sh script.
Note: Change the value of STACK if you changed it from the default.
export STACK=MSKToS3
cd /tmp/kafka/integration-sample-lambda-msk
./cleanup.sh $STACK
Go to the CloudFormation console. Make sure the deletion of the MSKToS3 stack is complete.
Click on the name of the MSK Cluster Stack that you created earlier (default MSK).
In the upper right hand corner, click on Delete.
When asked to confirm, click on Delete stack.
Repeat the steps above for the Cloud9 Bastion CloudFormation stack that you created earlier (default MSKClient). Make sure you select the Root stack and not the Nested Stacks.