DEV Community

LaTerral Williams
LaTerral Williams

Posted on

šŸ›”ļø Building a CASB‑Like Threat Monitoring Lab in AWS (Beginner Friendly)

⭐ Why I Built This Project (Project 3 of 6 — CASB‑Like Monitoring with GuardDuty + CloudTrail)

Instead of studying cloud security concepts in isolation, I’m using real job descriptions as a roadmap and building hands‑on projects that map directly to what employers expect in cloud security, cloud operations, and security engineering roles.

This 6‑part series focuses on practical skills such as:

  • Identity hardening and MFA enforcement
  • IAM governance and access reviews
  • Continuous monitoring of cloud resources
  • Log analysis, audit readiness, and evidence gathering
  • Guard rails at scale using AWS Organizations + Service Control Policies (SCPs)
  • Threat detection, anomaly monitoring, and incident triage

Each project reflects real‑world responsibilities, not just theoretical learning.


šŸ“Œ Project Sequence

šŸ‘‰ Part 1: AWS IAM Hardening — strengthening identity boundaries and improving authentication hygiene

šŸ‘‰ Part 2: Cloud Security Posture Management (CSPM) using Security Hub + AWS Config

šŸ‘‰ Part 3: (this project) — CASB‑Like Monitoring with GuardDuty + CloudTrail, focusing on real‑time detection, safe anomaly generation, delegated administrator behavior, and understanding how AWS produces threat intelligence findings


šŸ” Why This Progression Matters

Modern cloud security teams approach protection in layers.

Identity first → Posture second → Threat Detection next

Project 3 builds on the earlier foundations by adding behavioral visibility, anomaly detection, and event‑driven alerts core fundamentals used by SOC analysts, detection engineers, threat hunters, and cloud security specialists.

This lab simulates a lightweight Cloud Access Security Broker (CASB) workflow inside AWS using managed services, allowing you to explore:

  • CloudTrail event logging & integrity
  • GuardDuty findings (sample + real)
  • Safe adversary simulation
  • Region‑based anomaly detection
  • Delegated administrator restrictions
  • Cleanup for cost control

A hands‑on, beginner‑friendly guide to setting up threat monitoring in AWS, generating safe test activity, interpreting findings, troubleshooting delegated admin errors, and cleaning the environment properly.


Table of Contents

  1. Introduction
  2. What You Will Build
  3. Prerequisites
  4. Step 1 — Enable CloudTrail With Secure Settings
  5. Step 2 — Enable GuardDuty (Threat Detection)
  6. Step 3 — Generate Safe Test Activity
  7. Step 4 — Review GuardDuty Findings
  8. Step 5 — Cleanup to Avoid Costs
  9. Final Thoughts

Introduction

Cloud security monitoring doesn’t have to be complicated and you don’t need enterprise CASB tools to begin learning how threat detection works in the cloud.

This beginner‑friendly lab shows how to simulate CASB‑like monitoring using AWS CloudTrail + GuardDuty, while keeping everything free or extremely low‑cost.

You’ll generate safe test activity, view detections, and learn how these tools help security teams identify risky behavior inside AWS environments.

This guide also includes troubleshooting notes and real issues encountered during setup (manual KMS encryption, delegated admin restrictions, etc.) so beginners know what to expect.


What You Will Build

By the end of this lab you will have:

  • CloudTrail logging your AWS API activity
  • GuardDuty analyzing logs for threats
  • Sample findings + real findings from safe test events
  • A lightweight, CASB‑like monitoring workflow
  • A clean environment with no ongoing costs

Prerequisites

  • AWS account
  • IAM user or role with admin‑level permissions
  • A single region chosen for the lab (recommended: us-east-1)
  • Optional: AWS CLI installed

Step 1 — Enable CloudTrail With Secure Settings

CloudTrail records API activity across your AWS account. It’s the backbone for detection and threat monitoring.

āœ… Create a CloudTrail Trail

  1. Open CloudTrail → Trails → Create trail
  2. Name your trail:
   casb-guardduty-lab-trail
Enter fullscreen mode Exit fullscreen mode
  1. Create a new S3 bucket for logs
  2. Manually enable:
    • SSE‑KMS encryption (AWS managed key)
    • Log file validation

šŸ”Ž Many beginners miss this — CloudTrail does NOT always enable SSE-KMS or validation by default depending on UI version.

These settings add integrity and confidentiality protections to your logs.


Step 2 — Enable GuardDuty (Threat Detection)

GuardDuty analyzes CloudTrail logs, VPC Flow Logs, and DNS logs for suspicious or malicious activity.

āœ… Enable GuardDuty

  1. Open GuardDuty
  2. Click Enable GuardDuty
  3. If GuardDuty creates a Delegated Administrator, note it for cleanup later

You now have threat detection running automatically.


Step 3 — Generate Safe Test Activity

To make this a real learning experience, you’ll generate safe events that CloudTrail and GuardDuty can analyze.

šŸ”¹ Option A - Generate AWS Sample Findings

In GuardDuty:

  1. Open the Actions menu
  2. Choose Generate sample findings

These simulated attacks help you practice incident triage.


šŸ”¹ Option B - Generate Real CloudTrail Events

1. Console Login Events

  • Log out and back into the AWS console
  • Create a test IAM user and intentionally fail login attempts

These appear as ConsoleLogin events in CloudTrail.

2. Activity From an Unusual Region

  • Switch from your home region to eu-west-1 or ap-southeast-1
  • Open services or start to create resources (cancel before provisioning)

CloudTrail logs these actions with the region included.


Step 4 — Review GuardDuty Findings

Now you get to see your CASB‑like visibility in action.

šŸ” View All Findings

Go to:

GuardDuty → Findings

You may see findings such as:

  • UnauthorizedAccess:IAMUser/ConsoleLogin
  • Recon:EC2/PortProbe
  • AnomalousBehavior findings for unusual logins
  • Sample simulated threats such as:
    • IAM compromise sequences
    • EC2 compromise
    • Kubernetes or ECS compromise

If GuardDuty detects unusual database access, you may see:

A user successfully logged into an RDS database in an unusual way.
Severity: HIGH
Enter fullscreen mode Exit fullscreen mode

These help you understand what real-world threat detection looks like.


Step 5 — Cleanup to Avoid Costs

This lab is cheap, but not free if left running for days or months.

ā— REQUIRED: Remove Delegated Administrator First

You cannot disable GuardDuty until the delegated admin is removed.

  1. Open GuardDuty → Settings → Accounts
  2. Click Disable delegated administrator
  3. Confirm

Now you can safely disable GuardDuty.


āœ… Disable GuardDuty

  1. Open GuardDuty → Settings
  2. Choose Disable GuardDuty

āœ… Delete CloudTrail Trail

  1. Open CloudTrail → Trails
  2. Select your trail
  3. Delete it

āœ… Remove S3 Logs Bucket

  1. Empty the bucket
  2. Delete the bucket

āœ… Delete Test IAM User

If you created one for failed login testing.


Final Thoughts

This project gives you real hands‑on experience with:

  • Logging
  • Threat detection
  • Cloud security monitoring
  • CASB‑like visibility inside AWS
  • Proper cleanup and cost management

It’s a strong beginner → intermediate cloud security project you can showcase in a portfolio or LinkedIn post.


šŸ¤ Connect

If you enjoyed this article or you’re also learning DevOps, Linux, Security, or Cloud automation, I’d love to connect, share ideas, and learn.

šŸ’¬ Feel free to reach out or follow my journey on šŸ‘‰ LinkedIn

Top comments (0)