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. If not, ssh to the KafkaClientEC2Instance instance by pasting the ssh command you copied before.
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 Amazon EC2 console. We will cleanup the ENIs associated with Lambda. The Lamba service can take up to 24 hours to delete the ENIs and the CloudFormation stack delete will wait until timeout which can take a while, so we will clean it up manually.
In the left pane, click on Network Interfaces under Network & Security.
In the search box, type in Lambda and press Enter.
Wait for all the ENIs related to the Lambda service to change status from in-use to available, then select all of them and click on Delete.
Go to the CloudFormation console.
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.