Cleanup Resources
Cleanup AWS Resources
After completing the deployment and testing process, we need to clean up the resources to avoid unnecessary costs. Below are the steps to clean up the AWS resources we have used:
-
Delete EC2 Instances
- Access the AWS EC2 Console to delete unused instances.
- Select Instances in the AWS EC2 Console.
- Select both hacker-ec2 and user-ec2 instances.
- Select Instance state, then choose Terminate instance.
- Click Terminate to confirm the deletion.

-
Delete SNS Topic
- Access the AWS SNS Console to delete the
GuardDutyAlertTopic
topic.
- Select Topics, find the
GuardDutyAlertTopic
, and click Delete.
- Confirm by entering delete me and click delete.

-
Delete Lambda Function
- Access the AWS Lambda Console to delete the
HandleGuardDutyFinding
Lambda function.
- Select Functions, find the
HandleGuardDutyFinding
function, and click Delete.
- Confirm by entering confirm and click delete.

-
Delete EventBridge Rule
- Access the AWS EventBridge Console to delete the
GuardDutyTriggerLambda
rule.
- Select Rules, find the
GuardDutyTriggerLambda
rule, and click Delete.
- Confirm by entering delete and click delete.

-
Delete IAM Role
- Access the IAM Console to delete the
HandleGuardDutyFinding-role
.
- Select Roles, find the
HandleGuardDutyFinding-role
, and click Delete.
- Confirm by entering name role and click delete.

-
Delete VPC
- Access the AWS VPC Console to delete SecurityVPC.
- Select Your VPCs, find the
SecurityVPC
, then select Actions.
- Choose Delete VPC and confirm.

-
Delete GuardDuty
- Access the AWS GuardDuty Console to delete the GuardDuty service.
- Select Settings in the GuardDuty Console.
- Click Disable, then click Disable to confirm.

Notes
After deleting the resources, you can also check your AWS account to ensure that no resources are left behind and no unwanted costs are incurred.
Cleaning up resources after completing testing is very important to avoid unnecessary costs. Make sure all services have been deleted and no resources are left behind.