Resource Cleanup

Delete AWS SAM template

Extremely Important Note: You must strictly follow the order below. Absolutely do not delete the EC2 stack (wild-rydes-async-msg-0) first, because if the virtual machine is deleted, you will be disconnected from VS Code and won’t be able to run the commands to delete the resources inside!

  1. Open the Terminal in VS Code.
  2. Run the following command to delete the resources created by SAM:
cd ~/wild-rydes-async-messaging/code/lab-1
aws cloudformation delete-stack \
    --stack-name wild-rydes-async-msg-1
  1. Go to the CloudFormation Console in your web browser. Here you will see the remaining stacks. Select and delete them in order:
    • Note: Before deleting the aws-sam-cli-managed-default stack, you must go to the S3 service, find the SAM bucket, and click the Empty button to clean up the temporary files inside. If you skip this step, CloudFormation will throw an error saying “The bucket you tried to delete is not empty”.
    • After emptying the S3 bucket, go back and delete the aws-sam-cli-managed-default stack.
    • Finally, select the wild-rydes-async-msg-0 stack (the stack containing the EC2 instance) and click Delete to terminate the entire environment. Working with SNS