# ------------------------------------------ # CLEANUP # ------------------------------------------ # Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # optionally remove all the resources created # what we'll call this device # CHANGE THIS LINE TO YOUR NAME AND FAV COLOR THING_NAME=LastNameFavoriteColor # let’s work in our workshop folder cd ~/environment/aws-iot-core-workshop/code # Note: while in Cloud9 you may not have sufficient privileges to delete resources # See https://docs.aws.amazon.com/cloud9/latest/user-guide/auth-and-access-control.html#auth-and-access-control-temporary-managed-credentials # Also see https://gist.github.com/noahcoad/2cc1b251a7adf4240ae26a534f12b9b1#create-a-cloud9-development-environment # lab 5 # clean up via AWS Console # lab 4 # clean up via AWS Console # lab 3 aws iot delete-topic-rule --rule-name ${THING_NAME}_Dashboard_Connect aws iam delete-thing --thing-name ${THING_NAME} # lab 2 SNS_ARN=$(jq -r .TopicArn < sns-topic-create.out) aws sns delete-topic --topic-arn $SNS_ARN rm sns-topic-create.out # lab 1 CERT_ID=$(jq -r .certificateId < create-certs.out) aws iot detach-principal-policy --policy-name ${THING_NAME}-Policy --principal $CERT_ARN aws iot delete-policy --policy-name ${THING_NAME}-Policy aws iot detach-thing-principal --thing-name ${THING_NAME} --principal $CERT_ARN aws iot update-certificate --certificate-id $CERT_ID --new-status INACTIVE aws iot delete-certificate --certificate-id $CERT_ID aws iot delete-thing --thing-name ${THING_NAME} rm *.out *.pem *.key