Clean Up Resources

Amazon SNS

Following these steps.

  1. Access the EC2 interface, choose Auto Scaling groups.
    • Choose our Auto Scaling groups.
    • Click on Activity
    • In the Activity notifications interface, check the square. Go on Actions, choose Delete

ConnectPrivate

  1. Click on Delete

ConnectPrivate

  1. You will see an notification like below.

ConnectPrivate

  1. Access the SNS interface.

ConnectPrivate

  1. Click on Subscriptions. Choose the subscription and choose Delete.

ConnectPrivate

  1. Choose Delete

ConnectPrivate

  1. Now, let’s delete our Topics. Choose Topics.
    • Click on the circle.
    • Choose Delete

ConnectPrivate

  1. Type delete me and choose Delete

ConnectPrivate

Delete Resources using Terraform

Following these steps.

  1. First, open the terminal in Visual Studio Code. Type the following command.
terraform destroy
  • Optional: You can type terraform destroy -auto-approve to enforce terraform destroy. It means that you don’t need to enter yes.

ConnectPrivate

  1. After you run the command, you will see the output like this.

ConnectPrivate

  1. Enter yes to agree to destroy the resources.

ConnectPrivate

  1. The terraform destroy command is a convenient way to destroy all remote objects managed by a particular Terraform configuration.

ConnectPrivate

ConnectPrivate

  1. You can see that Terraform will delete the resources for us. We don’t need to go on the AWS Management Console and delete each resource.

  2. With Terraform, you can clearly see several benefits, including:

    • Automation: Terraform automates the process of provisioning and managing infrastructure, reducing the risk of human error and increasing efficiency.

    • Efficiency: Terraform reduces the time and effort required to manage infrastructure, allowing you to focus on higher-level tasks and increasing overall efficiency.

    • Cost-Effective: Terraform helps reduce costs by allowing you to manage infrastructure resources more efficiently, reducing waste, and optimizing resource utilization.

  3. You can view some resources Terraform has destroyed by using CloudTrail.

  4. Access the CloudTrail interface.

ConnectPrivate

  1. Click on Event history.

ConnectPrivate

  1. Here, you can see in the Event history interface.

ConnectPrivatet

  1. Optional: You can delete the access key and key pair used in this lab.