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
- Access the EC2 dashboard
- Navigate to Instances
- Select the instances associated with the lab
- Click on Instance state
- Select Terminate instance

Delete Amazon Machine Images (AMIs)
- Access the EC2 dashboard
- Go to AMIs in the left navigation pane
- Select the AMI you created during the lab
- Click on Actions
- Choose Deregister AMI

Delete EBS Snapshots
- Access the EC2 dashboard
- Navigate to Snapshots in the left navigation pane
- Select the snapshots associated with the lab
- Click on Actions
- Choose Delete snapshot

Delete Security Groups
- Access the EC2 dashboard
- Go to Security Groups in the left navigation pane
- Select the security groups associated with the lab
- Click on Actions
- Select Delete security group
⚠️ Warning: Ensure that the security group is not attached to any running instances before attempting to delete it.

Remove Key Pairs
- Access the EC2 dashboard
- Navigate to Key Pairs in the left navigation pane
- Select the key pair used for the lab
- Click on Actions
- Select Delete

Delete VPC Resources
- Access the VPC dashboard
- Navigate to Your VPCs in the left navigation pane
- Select the VPC associated with the lab
- Click on Actions
- 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.

Delete IAM Policies
- Access the IAM console
- In the search box, enter the names of the Policies created in the governance lab (Section 8)
- Select each Policy individually
- Click Delete
- 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.