Clean up resources

Clean Up Resources

ℹ️ Information: Properly cleaning up AWS resources after completing your lab is essential to avoid unexpected charges on your AWS account. Follow these steps to ensure all resources are terminated and deleted.

Terminate EC2 Instances

  1. Access the EC2 dashboard
  2. Navigate to Instances
  3. Select the instances associated with the lab
  4. Click on Instance state
  5. Select Terminate instance

Clean Up Resource

Delete Amazon Machine Images (AMIs)

  1. Access the EC2 dashboard
  2. Go to AMIs in the left navigation pane
  3. Select the AMI you created during the lab
  4. Click on Actions
  5. Choose Deregister AMI

Clean Up Resource

Delete EBS Snapshots

  1. Access the EC2 dashboard
  2. Navigate to Snapshots in the left navigation pane
  3. Select the snapshots associated with the lab
  4. Click on Actions
  5. Choose Delete snapshot

Clean Up Resource

Delete Security Groups

  1. Access the EC2 dashboard
  2. Go to Security Groups in the left navigation pane
  3. Select the security groups associated with the lab
  4. Click on Actions
  5. Select Delete security group

⚠️ Warning: Ensure that the security group is not attached to any running instances before attempting to delete it.

Clean Up Resource

Remove Key Pairs

  1. Access the EC2 dashboard
  2. Navigate to Key Pairs in the left navigation pane
  3. Select the key pair used for the lab
  4. Click on Actions
  5. Select Delete

Clean Up Resource

Delete VPC Resources

  1. Access the VPC dashboard
  2. Navigate to Your VPCs in the left navigation pane
  3. Select the VPC associated with the lab
  4. Click on Actions
  5. Select Delete VPC

💡 Pro Tip: Using the “Delete VPC” option will automatically delete associated subnets, route tables, internet gateways, and NAT gateways attached to the VPC.

Clean Up Resource

Delete IAM Policies

  1. Access the IAM console
  2. In the search box, enter the names of the Policies created in the governance lab (Section 8)
  3. Select each Policy individually
  4. Click Delete
  5. Confirm the deletion by typing the policy name when prompted

🔒 Security Note: Regularly review and clean up IAM policies that are no longer needed to maintain the principle of least privilege in your AWS account.