<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: LaTerral Williams</title>
    <description>The latest articles on Forem by LaTerral Williams (@ldwit).</description>
    <link>https://forem.com/ldwit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3053917%2Fe1143420-4be6-4382-b610-ea6fc4a3d21a.jpg</url>
      <title>Forem: LaTerral Williams</title>
      <link>https://forem.com/ldwit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ldwit"/>
    <language>en</language>
    <item>
      <title>Git &amp; GitHub for Beginners (Amazon Linux 2023): Fork, Branch, Commit, Pull Request (Walkthrough)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Sat, 31 Jan 2026 15:24:48 +0000</pubDate>
      <link>https://forem.com/ldwit/git-github-for-beginners-amazon-linux-2023-fork-branch-commit-pull-request-walkthrough-j74</link>
      <guid>https://forem.com/ldwit/git-github-for-beginners-amazon-linux-2023-fork-branch-commit-pull-request-walkthrough-j74</guid>
      <description>&lt;p&gt;This is a &lt;strong&gt;beginner-friendly, step-by-step; Git + GitHub walkthrough&lt;/strong&gt; you can follow on an AWS EC2 instance running &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt; (SSH access).&lt;/p&gt;

&lt;p&gt;By the end, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand &lt;strong&gt;Git vs GitHub&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Create a clean &lt;strong&gt;project workspace&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Install and configure Git &lt;strong&gt;locally per repo&lt;/strong&gt; (no global settings)&lt;/li&gt;
&lt;li&gt;Generate and add a &lt;strong&gt;GitHub SSH key&lt;/strong&gt; (with troubleshooting)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fork&lt;/strong&gt; an upstream repository&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clone&lt;/strong&gt; your fork to your VM&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;feature branch&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Edit &lt;code&gt;index.html&lt;/code&gt; + &lt;code&gt;style.css&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Commit changes, push to your fork, and open a &lt;strong&gt;Pull Request&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Understand what a PR does (&lt;strong&gt;and does not do&lt;/strong&gt;) to the original repo&lt;/li&gt;
&lt;li&gt;Optionally publish your page under Nginx as &lt;code&gt;/your-github-project/&lt;/code&gt; alongside an existing React deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Learning context:&lt;/strong&gt; This walkthrough supports self-paced learning and collaboration workflows using open-source materials.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Prerequisites&lt;/li&gt;
  &lt;li&gt;Git vs GitHub&lt;/li&gt;
  &lt;li&gt;Step 1 — Connect to Your VM&lt;/li&gt;
  &lt;li&gt;Step 2 — Install Git (Amazon Linux 2023)&lt;/li&gt;
  &lt;li&gt;Step 3 — Create a Clean Project Workspace&lt;/li&gt;
  &lt;li&gt;Step 4 — Local Git Config (Per Repository Only)&lt;/li&gt;
  &lt;li&gt;
Step 5 — Generate a GitHub SSH Key
    &lt;ul&gt;
      &lt;li&gt;Common Error: “Key is invalid…”&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Step 6 — Fork the Assignment Repo on GitHub&lt;/li&gt;
  &lt;li&gt;Step 7 — Clone Your Fork to the VM&lt;/li&gt;
  &lt;li&gt;Step 8 — Add Upstream (What It Does)&lt;/li&gt;
  &lt;li&gt;
Step 9 — Create a Feature Branch
    &lt;ul&gt;
      &lt;li&gt;How to Confirm You’re on the Right Branch&lt;/li&gt;
      &lt;li&gt;Why You Might See master Instead of main&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Step 10 — Make Your Changes (index.html + style.css)&lt;/li&gt;
  &lt;li&gt;Step 11 — Stage, Commit, and Review History&lt;/li&gt;
  &lt;li&gt;Step 12 — Push Your Branch to GitHub&lt;/li&gt;
  &lt;li&gt;
Step 13 — Open a Pull Request (PR)
    &lt;ul&gt;
      &lt;li&gt;Does a PR change the original repo?&lt;/li&gt;
      &lt;li&gt;Suggested PR Description&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Step 14 — Keep Your Fork Updated (Sync Upstream)&lt;/li&gt;
  &lt;li&gt;Debugging Example: UI Broke After CSS Update&lt;/li&gt;
  &lt;li&gt;Optional: Publish Under Nginx as /your-github-project/&lt;/li&gt;
  &lt;li&gt;Key Takeaways&lt;/li&gt;
  &lt;li&gt;Credits&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="prerequisites"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS EC2 instance running &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;SSH access to that instance&lt;/li&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;li&gt;Basic terminal comfort (copy/paste commands is fine)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optional (but helpful):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A text editor like &lt;code&gt;nano&lt;/code&gt; (I used vim)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="git-vs-github"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git vs GitHub
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt;: a version control tool that runs on your computer (or VM). It tracks changes to files over time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: a website that hosts Git repositories online so you can collaborate, share, and open pull requests.&lt;/p&gt;

&lt;p&gt;Simple analogy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git = the save/history engine&lt;/li&gt;
&lt;li&gt;GitHub = the online place where projects live and collaboration happens&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-1--connect-to-your-vm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 — Connect to Your VM
&lt;/h2&gt;

&lt;p&gt;From your local computer, connect to your EC2 instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; /path/to/your-key.pem ec2-user@YOUR_PUBLIC_IP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the pieces mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt; = secure shell (remote terminal)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-i ...pem&lt;/code&gt; = your EC2 private key file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ec2-user@...&lt;/code&gt; = the username and server address&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once logged in, you’re working on the VM.&lt;/p&gt;




&lt;p&gt;&lt;a id="step-2--install-git-amazon-linux-2023"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 — Install Git (Amazon Linux 2023)
&lt;/h2&gt;

&lt;p&gt;Update system packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf update &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flag notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sudo&lt;/code&gt; = run as admin&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dnf&lt;/code&gt; = Amazon Linux 2023 package manager&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-y&lt;/code&gt; = auto “yes” to prompts&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-3--create-a-clean-project-workspace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — Create a Clean Project Workspace
&lt;/h2&gt;

&lt;p&gt;Create a parent folder for all repos:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/projects
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do not&lt;/strong&gt; run &lt;code&gt;git init&lt;/code&gt; in &lt;code&gt;~/projects&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Each repo should be its own separate folder with its own &lt;code&gt;.git&lt;/code&gt; directory&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-4--local-git-config-per-repository-only"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 — Local Git Config (Per Repository Only)
&lt;/h2&gt;

&lt;p&gt;You asked an important question: “Global vs local?”&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global config&lt;/strong&gt; applies to all repos on this VM user account&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local config&lt;/strong&gt; applies only to one repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this walkthrough, we use &lt;strong&gt;local config only&lt;/strong&gt; to keep things isolated.&lt;/p&gt;

&lt;p&gt;You can only set local config &lt;strong&gt;after&lt;/strong&gt; a repo exists (after &lt;code&gt;git init&lt;/code&gt; or &lt;code&gt;git clone&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;We’ll do it after cloning in Step 7.&lt;/p&gt;




&lt;p&gt;&lt;a id="step-5--generate-a-github-ssh-key"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5 — Generate a GitHub SSH Key
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Should you add a passphrase?
&lt;/h3&gt;

&lt;p&gt;Recommended: &lt;strong&gt;Yes&lt;/strong&gt; (especially on cloud VMs). A passphrase protects your private key if the VM is compromised.&lt;/p&gt;

&lt;p&gt;Generate an SSH key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_EMAIL@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What flags mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-t ed25519&lt;/code&gt; = modern, secure key type&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-C&lt;/code&gt; = a label/comment (helps identify the key)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When prompted for a file location:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press Enter to accept the default (&lt;code&gt;~/.ssh/id_ed25519&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When prompted for passphrase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set a passphrase (recommended), then confirm it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start the SSH agent and add your key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;ssh-agent &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
ssh-add ~/.ssh/id_ed25519
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the &lt;strong&gt;public&lt;/strong&gt; key (this is what GitHub needs):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → SSH and GPG keys → New SSH key&lt;/li&gt;
&lt;li&gt;Key type: Authentication Key&lt;/li&gt;
&lt;li&gt;Paste the full line from &lt;code&gt;.pub&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test connectivity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A message saying you authenticated successfully (GitHub does not provide shell access)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="common-error-key-is-invalid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Error: “Key is invalid…”
&lt;/h3&gt;

&lt;p&gt;If GitHub says:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Key is invalid. You must supply a key in OpenSSH public key format”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It almost always means one of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You pasted the &lt;strong&gt;private key&lt;/strong&gt; by accident (wrong)&lt;/li&gt;
&lt;li&gt;You didn’t paste the &lt;code&gt;.pub&lt;/code&gt; key&lt;/li&gt;
&lt;li&gt;You included extra characters (like the terminal prompt)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix checklist:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make sure you copied &lt;strong&gt;only&lt;/strong&gt; the output of:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;It should be a &lt;strong&gt;single line&lt;/strong&gt; starting with:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ssh-ed25519 ...&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Do NOT paste:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;id_ed25519&lt;/code&gt; contents (private key)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$&lt;/code&gt; prompts or extra spaces&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;a id="step-6--fork-the-assignment-repo-on-github"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6 — Fork the Assignment Repo on GitHub
&lt;/h2&gt;

&lt;p&gt;Open the upstream repository in your browser:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/pravinmishraaws/Week-2---Git-GitHub-Assignment" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://github.com/pravinmishraaws/Week-2---Git-GitHub-Assignment" rel="noopener noreferrer"&gt;https://github.com/pravinmishraaws/Week-2---Git-GitHub-Assignment&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fork&lt;/strong&gt; (top right)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates your own copy under your account (example):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;https://github.com/yourusername/Week-2---Git-GitHub-Assignment&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why forks matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can change your fork freely&lt;/li&gt;
&lt;li&gt;You can open a PR to propose changes back to the original&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-7--clone-your-fork-to-the-vm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7 — Clone Your Fork to the VM
&lt;/h2&gt;

&lt;p&gt;In your VM terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects
git clone git@github.com:yourusername/Week-2---Git-GitHub-Assignment.git
&lt;span class="nb"&gt;cd &lt;/span&gt;Week-2---Git-GitHub-Assignment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;git clone&lt;/code&gt; downloads the repo and creates a folder&lt;/li&gt;
&lt;li&gt;It also sets a remote called &lt;code&gt;origin&lt;/code&gt; automatically&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check remotes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see &lt;code&gt;origin&lt;/code&gt; pointing to your fork.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set local git config in THIS repo
&lt;/h3&gt;

&lt;p&gt;Now that you’re inside the repo, set local config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.name &lt;span class="s2"&gt;"Your Username"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"yourusername@users.noreply.github.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify local settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--list&lt;/span&gt; &lt;span class="nt"&gt;--local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="step-8--add-upstream-what-it-does"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8 — Add Upstream (What It Does)
&lt;/h2&gt;

&lt;p&gt;Add the original repo as &lt;code&gt;upstream&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add upstream https://github.com/pravinmishraaws/Week-2---Git-GitHub-Assignment.git
git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;origin&lt;/code&gt; = your fork (where you push)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;upstream&lt;/code&gt; = original repo (where you fetch updates)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It does NOT:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;merge changes automatically&lt;/li&gt;
&lt;li&gt;change the original repo&lt;/li&gt;
&lt;li&gt;give you permission to push to upstream&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-9--create-a-feature-branch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 9 — Create a Feature Branch
&lt;/h2&gt;

&lt;p&gt;Create and switch to a new branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; your-branch-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why branch?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps your changes separate from the default branch&lt;/li&gt;
&lt;li&gt;Makes PRs clean and reviewable&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="how-to-confirm-youre-on-the-right-branch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Confirm You’re on the Right Branch
&lt;/h3&gt;

&lt;p&gt;Use any of these:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for: &lt;code&gt;On branch ...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The branch with &lt;code&gt;*&lt;/code&gt; is your current branch.&lt;/p&gt;

&lt;p&gt;Or quick output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;--show-current&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="why-you-might-see-master-instead-of-main"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why You Might See master Instead of main
&lt;/h3&gt;

&lt;p&gt;Some repos use &lt;code&gt;master&lt;/code&gt; as the default branch instead of &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is normal.&lt;br&gt;
There is no functional difference for this assignment.&lt;/p&gt;

&lt;p&gt;Use whatever default branch exists in your repo.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-10--make-your-changes-indexhtml--stylecss"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 10 — Make Your Changes (index.html + style.css)
&lt;/h2&gt;

&lt;p&gt;Edit your files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim index.html
vim style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vim basics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you first open a file, Vim is in &lt;strong&gt;command mode&lt;/strong&gt; (you cannot type yet)&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;i&lt;/code&gt; to enter &lt;strong&gt;insert mode&lt;/strong&gt; (so you can type and edit)&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;Esc&lt;/code&gt; to leave insert mode&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;:w&lt;/code&gt; then press Enter to &lt;strong&gt;save&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;:q&lt;/code&gt; then press Enter to &lt;strong&gt;quit&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;:wq&lt;/code&gt; then Enter to &lt;strong&gt;save and quit&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;:q!&lt;/code&gt; then Enter to &lt;strong&gt;quit without saving&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make your updates (student details + theme).&lt;/p&gt;




&lt;p&gt;&lt;a id="step-11--stage-commit-and-review-history"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 11 — Stage, Commit, and Review History
&lt;/h2&gt;

&lt;p&gt;Check what changed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Preview changes line-by-line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stage (add to the “next commit”):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit (save snapshot):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Your descriptive commit note"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="step-12--push-your-branch-to-github"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 12 — Push Your Branch to GitHub
&lt;/h2&gt;

&lt;p&gt;Push your branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin your-branch-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What &lt;code&gt;-u&lt;/code&gt; does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sets tracking so next time you can run &lt;code&gt;git push&lt;/code&gt; without extra arguments&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="step-13--open-a-pull-request-pr"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 13 — Open a Pull Request (PR)
&lt;/h2&gt;

&lt;p&gt;On GitHub, go to your fork repo page.&lt;br&gt;
You should see a prompt like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Compare &amp;amp; pull request”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create a PR:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Base repository: &lt;code&gt;pravinmishraaws/Week-2---Git-GitHub-Assignment&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Base branch: &lt;code&gt;main&lt;/code&gt; or &lt;code&gt;master&lt;/code&gt; (whatever the upstream uses)&lt;/li&gt;
&lt;li&gt;Compare branch: your branch (&lt;code&gt;your-branch-name&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;a id="does-a-pr-change-the-original-repo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Does a PR change the original repo?
&lt;/h3&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;A PR is a &lt;strong&gt;request&lt;/strong&gt; to merge.&lt;br&gt;
The upstream repo does not change until:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the maintainer approves and merges it&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;a id="suggested-pr-description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Suggested PR Description
&lt;/h3&gt;

&lt;p&gt;You can paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This pull request is for learning purposes only.

The goal is to practice the GitHub pull request workflow, understand how forks and branches are compared, and learn how collaboration works in a real repository. The changes are intentionally simple and focused on hands-on learning rather than introducing new features.

Thank you, Pravin, for providing open-source learning materials and repositories that make it easier to learn Git and GitHub through real practice.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="step-14--keep-your-fork-updated-sync-upstream"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 14 — Keep Your Fork Updated (Sync Upstream)
&lt;/h2&gt;

&lt;p&gt;If upstream changes later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git fetch upstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Merge upstream changes into your default branch (example uses master):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch master
git merge upstream/master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Push updates to your fork:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;main&lt;/code&gt; if your repo uses main instead of master.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fetch&lt;/code&gt; is safe because it downloads without changing files until you merge.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="debugging-example-ui-broke-after-css-update"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Example: UI Broke After CSS Update
&lt;/h2&gt;

&lt;p&gt;Scenario:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You update &lt;code&gt;style.css&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The page layout looks broken&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Find recent commits that touched the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--&lt;/span&gt; style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you know the commit hash that introduced the issue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff &amp;lt;good_commit_hash&amp;gt; &amp;lt;bad_commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this matters (DevOps mindset):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You may not be the original author&lt;/li&gt;
&lt;li&gt;You still need to identify what changed and when&lt;/li&gt;
&lt;li&gt;Git history is a debugging tool, not just “backup”&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="optional-publish-under-nginx-as-your-github-project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional: Publish Under Nginx as /your-github-project/
&lt;/h2&gt;

&lt;p&gt;This is optional, but it’s a great real-world deployment skill:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;serve your Git assignment page alongside your React app via Nginx&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reference article (React + Nginx deployment on Amazon Linux):&lt;br&gt;
&lt;a href="https://dev.to/ldwit/deploying-a-react-app-with-nginx-on-aws-amazon-linux-beginner-walkthrough-3h76"&gt;&lt;/a&gt;&lt;a href="https://dev.to/ldwit/deploying-a-react-app-with-nginx-on-aws-amazon-linux-beginner-walkthrough-3h76"&gt;https://dev.to/ldwit/deploying-a-react-app-with-nginx-on-aws-amazon-linux-beginner-walkthrough-3h76&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Confirm your Nginx root
&lt;/h3&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-T&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example setup, the active root was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/var/www/react-app/current&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create a folder for your static page
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /var/www/react-app/current/your-github-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy your assignment files into that folder
&lt;/h3&gt;

&lt;p&gt;From your repo folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo cp &lt;/span&gt;index.html style.css /var/www/react-app/current/your-github-project/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fix permissions (avoid 403 errors)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 755 /var/www/react-app/current/your-github-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Reload Nginx safely
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Test it
&lt;/h3&gt;

&lt;p&gt;Open:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://YOUR_PUBLIC_IP/your-github-project/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="key-takeaways"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Git tracks history in commits&lt;/li&gt;
&lt;li&gt;Staging (&lt;code&gt;git add&lt;/code&gt;) is your “commit preview”&lt;/li&gt;
&lt;li&gt;Branches keep work isolated&lt;/li&gt;
&lt;li&gt;Fork + PR is the safe collaboration workflow&lt;/li&gt;
&lt;li&gt;A PR does not change upstream until merged&lt;/li&gt;
&lt;li&gt;Git commands like &lt;code&gt;log&lt;/code&gt; and &lt;code&gt;diff&lt;/code&gt; help debug issues quickly&lt;/li&gt;
&lt;li&gt;Nginx can serve static pages alongside apps for portfolio demos&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="credits"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pravin Mishra&lt;/strong&gt; -- open-source DevOps learning materials and the DMI community&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Self-paced practice and notes from a real Amazon Linux 2023 VM workflow&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Udemy Course&lt;/strong&gt; -- &lt;em&gt;DevOps for Beginners: Docker, Kubernetes, Cloud &amp;amp; CI/CD (4 Projects)&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/devops-for-beginners-docker-k8s-cloud-cicd-4-projects/" rel="noopener noreferrer"&gt;https://www.udemy.com/course/devops-for-beginners-docker-k8s-cloud-cicd-4-projects/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;GitHub Repository&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/pravinmishraaws" rel="noopener noreferrer"&gt;https://github.com/pravinmishraaws&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>🚀 Deploying a React App with NGINX on AWS (Amazon Linux) — Beginner Walkthrough</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Wed, 28 Jan 2026 16:04:22 +0000</pubDate>
      <link>https://forem.com/ldwit/deploying-a-react-app-with-nginx-on-aws-amazon-linux-beginner-walkthrough-3h76</link>
      <guid>https://forem.com/ldwit/deploying-a-react-app-with-nginx-on-aws-amazon-linux-beginner-walkthrough-3h76</guid>
      <description>&lt;p&gt;This project documents a &lt;strong&gt;beginner-friendly, real-world style deployment&lt;/strong&gt; of a React application using &lt;strong&gt;NGINX on an AWS EC2 instance running Amazon Linux&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The goal was to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep costs low&lt;/li&gt;
&lt;li&gt;Avoid over-engineering&lt;/li&gt;
&lt;li&gt;Learn how Linux + NGINX actually serve frontend apps&lt;/li&gt;
&lt;li&gt;Debug real problems instead of hiding them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This walkthrough reflects the &lt;strong&gt;exact path taken&lt;/strong&gt;, including lessons learned during troubleshooting.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What You’ll Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How NGINX serves a static React build&lt;/li&gt;
&lt;li&gt;How to deploy a React app directly on an EC2 instance&lt;/li&gt;
&lt;li&gt;Why Single Page Applications (SPAs) need special NGINX configuration&lt;/li&gt;
&lt;li&gt;How to diagnose and fix common NGINX errors (500 errors, redirect loops)&lt;/li&gt;
&lt;li&gt;How Node.js versions affect modern frontend tooling&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💰 Cost &amp;amp; Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Provider&lt;/strong&gt;: AWS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance Type&lt;/strong&gt;: t2.micro / t3.micro&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS&lt;/strong&gt;: Amazon Linux 2023&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Server&lt;/strong&gt;: NGINX&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: React (Vite)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Estimated Cost&lt;/strong&gt;: Free tier or a few dollars/month&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🏗️ Architecture Overview
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
Public IP (EC2)
   ↓
NGINX (port 80)
   ↓
/var/www/react-app
   ↓
React build (index.html, JS, CSS)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NGINX serves &lt;strong&gt;static files only&lt;/strong&gt;. React is built first, then copied into the web root.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔐 Phase 1: Launch the EC2 Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Launch a new EC2 instance&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose instance type: &lt;code&gt;t2.micro&lt;/code&gt; or &lt;code&gt;t3.micro&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Auto-assign Public IP&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Security Group (Inbound Rules)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;Your IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;td&gt;0.0.0.0/0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;SSH is restricted. HTTP is public so the app is accessible.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Do not forget to create your Key Pair and &lt;strong&gt;save in a location you can find later&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I used my linux desktop to connect to the instance so my key needed to be in the same directory where I was launching ssh.&lt;/p&gt;

&lt;p&gt;If you are using an ssh tool (like Putty) you will need to upload the key into the ssh tool, so it is important to remember where you saved the key.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔑 Phase 2: Connect to the Instance
&lt;/h2&gt;

&lt;p&gt;From your local machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; your-key.pem ec2-user@&amp;lt;PUBLIC_IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Linux uses the &lt;code&gt;ec2-user&lt;/code&gt; account by default.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧰 Phase 3: Install System Dependencies
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Update packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf update &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install NGINX
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; nginx
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--now&lt;/span&gt; nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status nginx &lt;span class="nt"&gt;--no-pager&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚙️ Phase 4: Install Node.js (Temporary Session)
&lt;/h2&gt;

&lt;p&gt;Modern React tools require newer Node versions.&lt;br&gt;&lt;br&gt;
For this project, Node was upgraded &lt;strong&gt;for the active shell only&lt;/strong&gt; (not persisted across reboots).&lt;/p&gt;

&lt;p&gt;Install nvm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o-&lt;/span&gt; https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: I did not use this step, as I completed this in a single sitting. I only used &lt;code&gt;exec bash&lt;/code&gt; to refresh the shell. This step may be necessary if you need the shell to persist to continue work later.&lt;/p&gt;

&lt;p&gt;Load nvm &lt;strong&gt;for the current shell&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;NVM_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/.nvm"&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NVM_DIR&lt;/span&gt;&lt;span class="s2"&gt;/nvm.sh"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NVM_DIR&lt;/span&gt;&lt;span class="s2"&gt;/nvm.sh"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;Install and use Node 22:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm &lt;span class="nb"&gt;install &lt;/span&gt;22
nvm use 22
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: Node will revert to the system version after logout unless nvm is persisted.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ⚛️ Phase 5: Create and Build the React App
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create the project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/projects
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects
npm create vite@latest react-app &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;span class="nb"&gt;cd &lt;/span&gt;react-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build for production
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The production-ready files are created in the &lt;code&gt;dist/&lt;/code&gt; directory.&lt;/p&gt;




&lt;h2&gt;
  
  
  📁 Phase 6: Create the NGINX Web Root
&lt;/h2&gt;

&lt;p&gt;Create a directory for the React app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /var/www/react-app
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; ec2-user:ec2-user /var/www/react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the build output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; /var/www/react-app/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;span class="nb"&gt;sudo cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; dist/&lt;span class="k"&gt;*&lt;/span&gt; /var/www/react-app/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fix permissions so NGINX can read files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; nginx:nginx /var/www/react-app
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 755 /var/www/react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🌐 Phase 7: Configure NGINX for React (SPA Routing)
&lt;/h2&gt;

&lt;p&gt;Create the NGINX configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/nginx/conf.d/react-app.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt; &lt;span class="s"&gt;default_server&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="n"&gt;/var/www/react-app&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;index&lt;/span&gt; &lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;try_files&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt;&lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="n"&gt;/index.html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable the default config if present:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mv&lt;/span&gt; /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.disabled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test and restart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ✅ Phase 8: Verify Deployment
&lt;/h2&gt;

&lt;p&gt;From the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-I&lt;/span&gt; http://localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From your browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://&amp;lt;EC2_PUBLIC_IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your React app should now load successfully.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧯 Troubleshooting (Lessons Learned)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ❌ 500 Internal Server Error
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NGINX root pointed to a directory that did not exist&lt;/li&gt;
&lt;li&gt;Missing &lt;code&gt;index.html&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /var/www/react-app/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure the build was copied correctly.&lt;/p&gt;




&lt;h3&gt;
  
  
  ❌ Infinite redirect / rewrite loop
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Error&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rewrite or internal redirection cycle while internally redirecting to "/index.html"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SPA routing without proper &lt;code&gt;try_files&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Conflicting server blocks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disable &lt;code&gt;default.conf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use a single &lt;code&gt;server&lt;/code&gt; block&lt;/li&gt;
&lt;li&gt;Verify &lt;code&gt;try_files&lt;/code&gt; configuration&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ❌ Vite / crypto.hash error
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js version too old&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm use 22
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; node_modules package-lock.json
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project intentionally avoided:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load balancers&lt;/li&gt;
&lt;li&gt;Containers&lt;/li&gt;
&lt;li&gt;CI/CD pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, it focused on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux fundamentals&lt;/li&gt;
&lt;li&gt;NGINX configuration&lt;/li&gt;
&lt;li&gt;Real debugging scenarios&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can deploy and troubleshoot &lt;strong&gt;this setup&lt;/strong&gt;, you’re building the right foundation.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔜 Possible Next Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Persist Node using nvm&lt;/li&gt;
&lt;li&gt;Add HTTPS with Let’s Encrypt&lt;/li&gt;
&lt;li&gt;Introduce a release + rollback structure&lt;/li&gt;
&lt;li&gt;Move the frontend to S3 + CloudFront&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🙏 Credits &amp;amp; Learning Acknowledgement
&lt;/h3&gt;

&lt;p&gt;This project builds on foundational DevOps concepts learned from &lt;strong&gt;Pravin Mishra&lt;/strong&gt; teaching; beginner-focused content providing an initial framework for understanding how applications move from development to deployment.&lt;/p&gt;

&lt;p&gt;The original learning foundation came from the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Udemy Course&lt;/strong&gt; -- &lt;em&gt;DevOps for Beginners: Docker, Kubernetes, Cloud &amp;amp; CI/CD (4 Projects)&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/devops-for-beginners-docker-k8s-cloud-cicd-4-projects/" rel="noopener noreferrer"&gt;https://www.udemy.com/course/devops-for-beginners-docker-k8s-cloud-cicd-4-projects/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;GitHub Repository&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/pravinmishraaws" rel="noopener noreferrer"&gt;https://github.com/pravinmishraaws&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  How This Project Differs and Expands
&lt;/h4&gt;

&lt;p&gt;While the course introduced core ideas, this implementation represents my own hands-on work and problem-solving, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploying a React application on &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Configuring &lt;strong&gt;NGINX to serve a Single Page Application (SPA)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Troubleshooting real-world issues such as:

&lt;ul&gt;
&lt;li&gt;Node.js version incompatibilities with modern tooling&lt;/li&gt;
&lt;li&gt;NGINX 500 Internal Server Errors&lt;/li&gt;
&lt;li&gt;SPA rewrite and redirect loops&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Adapting the deployment process to fit a &lt;strong&gt;low-cost, beginner-accessible AWS setup&lt;/strong&gt;
&lt;/li&gt;

&lt;li&gt;Documenting mistakes, fixes, and reasoning to reflect the actual learning process&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;All configuration choices, debugging steps, and documentation in this project reflect my own experimentation and understanding, built on top of the foundational concepts introduced in the referenced materials.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>linux</category>
      <category>cloud</category>
      <category>react</category>
    </item>
    <item>
      <title>🔒 Building a Secure AWS Environment with Terraform + AWS CloudShell</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Mon, 29 Dec 2025 12:27:42 +0000</pubDate>
      <link>https://forem.com/ldwit/building-a-secure-aws-environment-with-terraform-aws-cloudshell-54b0</link>
      <guid>https://forem.com/ldwit/building-a-secure-aws-environment-with-terraform-aws-cloudshell-54b0</guid>
      <description>&lt;h1&gt;
  
  
  ⭐ Why I Built This Project
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;(Project 6 of 6 — Terraform Security Module: Secure AWS Baseline with Infrastructure as Code)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of studying cloud security concepts in isolation, I’m using &lt;strong&gt;real job descriptions&lt;/strong&gt; as a roadmap and building hands-on projects that map directly to cloud security, cloud operations, and security engineering roles.&lt;/p&gt;

&lt;p&gt;This 6-part series focuses on practical, cloud security skills, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity hardening and MFA enforcement
&lt;/li&gt;
&lt;li&gt;IAM governance and access reviews
&lt;/li&gt;
&lt;li&gt;Continuous monitoring of cloud resources
&lt;/li&gt;
&lt;li&gt;Misconfiguration detection and drift analysis
&lt;/li&gt;
&lt;li&gt;Log analysis, audit readiness, and evidence gathering
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure-as-Code (IaC) security baselines and guardrails&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Guard rails at scale using AWS Organizations + Service Control Policies (SCPs)
&lt;/li&gt;
&lt;li&gt;Threat detection, anomaly monitoring, and incident triage
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each project is designed to reflect &lt;strong&gt;real-world responsibilities&lt;/strong&gt;, not just theoretical learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Project Sequence
&lt;/h2&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1:&lt;/strong&gt; AWS IAM Hardening — strengthening identity boundaries and improving authentication hygiene&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 2:&lt;/strong&gt; Cloud Security Posture Management (CSPM) using &lt;strong&gt;Security Hub + AWS Config&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 3:&lt;/strong&gt; CASB-Like Monitoring with &lt;strong&gt;GuardDuty + CloudTrail&lt;/strong&gt;, focusing on anomalies, delegated admin, and safe threat simulation&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 4:&lt;/strong&gt; Drift Detection with &lt;strong&gt;AWS Config&lt;/strong&gt;, using managed rules, EventBridge routing, tags, and optional remediation&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 5:&lt;/strong&gt; Log Analysis &amp;amp; Dashboards with &lt;strong&gt;Athena + QuickSight&lt;/strong&gt;, turning raw CloudTrail logs into actionable security insights&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 6:&lt;/strong&gt; (&lt;em&gt;this project&lt;/em&gt;) — &lt;strong&gt;Terraform Security Module&lt;/strong&gt;, building a secure AWS baseline using Infrastructure as Code  &lt;/p&gt;


&lt;h2&gt;
  
  
  🧱 Why This Project Matters
&lt;/h2&gt;

&lt;p&gt;In real-world cloud environments, security doesn’t start in the console, it starts in &lt;strong&gt;code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Modern cloud security teams rely on &lt;strong&gt;Infrastructure as Code (IaC)&lt;/strong&gt; tools like &lt;strong&gt;Terraform&lt;/strong&gt; to ensure environments are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secure by default
&lt;/li&gt;
&lt;li&gt;Consistent across deployments
&lt;/li&gt;
&lt;li&gt;Auditable and reviewable
&lt;/li&gt;
&lt;li&gt;Resistant to configuration drift
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project focuses on using &lt;strong&gt;Terraform&lt;/strong&gt; to define and deploy a &lt;strong&gt;secure AWS foundation&lt;/strong&gt;, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A baseline &lt;strong&gt;VPC&lt;/strong&gt; configuration
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;secure S3 bucket&lt;/strong&gt; with encryption, versioning, and public access blocked
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudTrail logging&lt;/strong&gt; enforced through code
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of manually clicking through the AWS console, this project demonstrates how security controls can be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version-controlled
&lt;/li&gt;
&lt;li&gt;Peer-reviewed
&lt;/li&gt;
&lt;li&gt;Re-deployed on demand
&lt;/li&gt;
&lt;li&gt;Automatically restored if misconfigured
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll also see how Terraform helps &lt;strong&gt;detect and prevent drift&lt;/strong&gt;, a critical requirement in regulated and enterprise cloud environments.&lt;/p&gt;

&lt;p&gt;To keep the project accessible and low-cost, Terraform is executed using &lt;strong&gt;AWS CloudShell&lt;/strong&gt;, eliminating local installation challenges (especially on Windows ARM systems) while still following real-world DevSecOps workflows.&lt;/p&gt;

&lt;p&gt;By the end of this project, you’ll have a &lt;strong&gt;repeatable, secure AWS baseline&lt;/strong&gt; defined entirely in code, a strong capstone that ties together identity, monitoring, logging, and governance concepts from the entire series and aligns directly with expectations for cloud security and cloud operations roles.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Beginner-Friendly | Fun | Technical | Real-World Cloud Security Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Welcome to &lt;strong&gt;Project 6 - Terraform Security Module&lt;/strong&gt;, where you’ll learn how to build a secure AWS baseline using &lt;strong&gt;Terraform&lt;/strong&gt;, &lt;strong&gt;AWS CloudShell&lt;/strong&gt;, and a workflow that mirrors real cloud security engineering. &lt;/p&gt;

&lt;p&gt;This guide is fun, practical, and perfect for beginners who want hands-on cloud security experience without breaking the bank.&lt;/p&gt;


&lt;h1&gt;
  
  
  📚 Table of Contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction
&lt;/li&gt;
&lt;li&gt;
Why This Project Matters
&lt;/li&gt;
&lt;li&gt;
Prerequisites
&lt;/li&gt;
&lt;li&gt;
Using VS Code vs CloudShell
&lt;/li&gt;
&lt;li&gt;
Setting Up AWS CloudShell
&lt;/li&gt;
&lt;li&gt;
Creating Your Terraform Project Structure
&lt;/li&gt;
&lt;li&gt;
Writing Terraform Configuration Files
&lt;/li&gt;
&lt;li&gt;
Initializing Terraform
&lt;/li&gt;
&lt;li&gt;
Planning and Applying
&lt;/li&gt;
&lt;li&gt;
Verifying the Deployment
&lt;/li&gt;
&lt;li&gt;
Cleaning Up Resources
&lt;/li&gt;
&lt;li&gt;
Troubleshooting Tips
&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;


&lt;h1&gt;
  
  
  &lt;a id="introduction"&gt;&lt;/a&gt;🌟 Introduction
&lt;/h1&gt;

&lt;p&gt;Terraform is one of the most powerful Infrastructure-as-Code (IaC) tools in the cloud ecosystem.&lt;br&gt;&lt;br&gt;
But installing Terraform locally, especially on Windows ARM devices, can get complicated.&lt;/p&gt;

&lt;p&gt;So instead, we take the &lt;em&gt;fun&lt;/em&gt;, &lt;em&gt;beginner-friendly&lt;/em&gt;, &lt;em&gt;zero-hassle&lt;/em&gt; route:&lt;br&gt;&lt;br&gt;
🎉 &lt;strong&gt;Run Terraform directly inside AWS CloudShell&lt;/strong&gt;, which comes preconfigured with AWS credentials and a Linux environment, exactly like real DevOps teams use.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="why-this-project-matters"&gt;&lt;/a&gt;🔐 Why This Project Matters
&lt;/h1&gt;

&lt;p&gt;You will create three essential security components using Terraform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;VPC&lt;/strong&gt; (Virtual Private Cloud)
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Secure S3 Bucket&lt;/strong&gt; for CloudTrail logs
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;CloudTrail Trail&lt;/strong&gt; for auditing AWS activity
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are foundational in &lt;strong&gt;cloud security operations&lt;/strong&gt;, &lt;strong&gt;compliance&lt;/strong&gt;, and &lt;strong&gt;threat detection&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This entire environment is:&lt;/p&gt;

&lt;p&gt;✔ Free or extremely low-cost&lt;br&gt;&lt;br&gt;
✔ Fully repeatable using IaC&lt;br&gt;&lt;br&gt;
✔ Destroyable in minutes&lt;br&gt;&lt;br&gt;
✔ Perfect for portfolios&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="prerequisites"&gt;&lt;/a&gt;🧰 Prerequisites
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;AWS account
&lt;/li&gt;
&lt;li&gt;Basic familiarity with AWS Console
&lt;/li&gt;
&lt;li&gt;A browser (for CloudShell)
&lt;/li&gt;
&lt;li&gt;Optional: VS Code for code editing
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No Terraform account required.&lt;br&gt;&lt;br&gt;
No installations on your laptop required.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="using-vs-code-vs-cloudshell"&gt;&lt;/a&gt;💻 Using VS Code vs AWS CloudShell
&lt;/h1&gt;

&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; write Terraform locally in VS Code, but ARM64 Windows devices don’t have native Terraform binaries.&lt;/p&gt;

&lt;p&gt;So the recommended approach is:&lt;/p&gt;
&lt;h3&gt;
  
  
  🥇 Use VS Code for &lt;em&gt;editing&lt;/em&gt;
&lt;/h3&gt;
&lt;h3&gt;
  
  
  🥇 Use AWS CloudShell for &lt;em&gt;running&lt;/em&gt; Terraform
&lt;/h3&gt;

&lt;p&gt;CloudShell gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux environment
&lt;/li&gt;
&lt;li&gt;Pre-installed Terraform (or installable)
&lt;/li&gt;
&lt;li&gt;Preconfigured IAM authentication
&lt;/li&gt;
&lt;li&gt;Safe sandbox
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This combo gives you &lt;strong&gt;real-world DevSecOps workflow&lt;/strong&gt;.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="setting-up-aws-cloudshell"&gt;&lt;/a&gt;☁️ Setting Up AWS CloudShell
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Log in to the AWS Console
&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;CloudShell terminal icon&lt;/strong&gt; in the upper-right corner
&lt;/li&gt;
&lt;li&gt;CloudShell opens a terminal inside AWS
&lt;/li&gt;
&lt;li&gt;Check if Terraform is installed:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If Terraform is missing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;uname -m&lt;/code&gt; to detect architecture
&lt;/li&gt;
&lt;li&gt;Install Terraform using the latest ARM64 or AMD64 Linux binary
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install -y wget unzip

TERRAFORM_VERSION="1.14.2" 

//At the time of this project **1.14.2** was the most recent version of terraform.

wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip

unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip

sudo mv terraform /usr/local/bin/

terraform version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;a id="creating-your-terraform-project-structure"&gt;&lt;/a&gt;📁 Creating Your Terraform Project Structure
&lt;/h1&gt;

&lt;p&gt;Inside CloudShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;terraform-security-module
&lt;span class="nb"&gt;cd &lt;/span&gt;terraform-security-module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recommended real-world folder structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform-security-module/
│
├── main.tf
├── variables.tf
├── outputs.tf
├── versions.tf
└── .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a &lt;code&gt;.gitignore&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.terraform/
terraform.tfstate
terraform.tfstate.backup
*.backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  &lt;a id="writing-terraform-configuration-files"&gt;&lt;/a&gt;🛠 Writing Terraform Configuration Files
&lt;/h1&gt;

&lt;p&gt;Below is the full configuration needed to deploy a secure AWS baseline.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔹 versions.tf
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;terraform&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;required_version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&amp;gt;= 1.5.0"&lt;/span&gt;

  &lt;span class="nx"&gt;required_providers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;aws&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;source&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"hashicorp/aws"&lt;/span&gt;
      &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 5.0"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;region&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_region&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔹 variables.tf
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"aws_region"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AWS region to deploy into"&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"project_name"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Prefix for all resource names"&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tf-security-demo"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔹 main.tf
&lt;/h2&gt;

&lt;p&gt;Contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPC
&lt;/li&gt;
&lt;li&gt;S3 bucket
&lt;/li&gt;
&lt;li&gt;Public access block
&lt;/li&gt;
&lt;li&gt;Versioning
&lt;/li&gt;
&lt;li&gt;Encryption
&lt;/li&gt;
&lt;li&gt;Bucket policy
&lt;/li&gt;
&lt;li&gt;CloudTrail &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;I added notes to describe what each section should complete.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Create a basic VPC&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc"&lt;/span&gt; &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_block&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.0.0/16"&lt;/span&gt;
  &lt;span class="nx"&gt;enable_dns_hostnames&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;enable_dns_support&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.project_name}-vpc"&lt;/span&gt;
    &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"lab"&lt;/span&gt;
    &lt;span class="nx"&gt;ManagedBy&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Generate Unique Suffix to Avoid Bucket Name Conflicts&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"random_id"&lt;/span&gt; &lt;span class="s2"&gt;"suffix"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;byte_length&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Create the Bucket&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket"&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bucket&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.project_name}-cloudtrail-logs-${random_id.suffix.hex}"&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.project_name}-cloudtrail-logs"&lt;/span&gt;
    &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"lab"&lt;/span&gt;
    &lt;span class="nx"&gt;ManagedBy&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Block All Public Access&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_public_access_block"&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bucket&lt;/span&gt;                  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;block_public_acls&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;block_public_policy&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;ignore_public_acls&lt;/span&gt;      &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;restrict_public_buckets&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Enable Versioning&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_versioning"&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bucket&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;versioning_configuration&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Enable Encryption (SSE-S3)&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_server_side_encryption_configuration"&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bucket&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;rule&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;apply_server_side_encryption_by_default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;sse_algorithm&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AES256"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Bucket Policy for CloudTrail&lt;/span&gt;

&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_caller_identity"&lt;/span&gt; &lt;span class="s2"&gt;"current"&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_policy"&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bucket&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;policy&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;Version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
    &lt;span class="nx"&gt;Statement&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;Sid&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AWSCloudTrailAclCheck"&lt;/span&gt;
        &lt;span class="nx"&gt;Effect&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
        &lt;span class="nx"&gt;Principal&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;Service&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail.amazonaws.com"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;Action&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"s3:GetBucketAcl"&lt;/span&gt;
        &lt;span class="nx"&gt;Resource&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arn&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;Sid&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AWSCloudTrailWrite"&lt;/span&gt;
        &lt;span class="nx"&gt;Effect&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
        &lt;span class="nx"&gt;Principal&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;Service&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail.amazonaws.com"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;Action&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"s3:PutObject"&lt;/span&gt;
        &lt;span class="nx"&gt;Resource&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${aws_s3_bucket.cloudtrail_logs.arn}/AWSLogs/${data.aws_caller_identity.current.account_id}/*"&lt;/span&gt;
        &lt;span class="nx"&gt;Condition&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;StringEquals&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"s3:x-amz-acl"&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"bucket-owner-full-control"&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Create a CloudTrail Trail&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_cloudtrail"&lt;/span&gt; &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;                          &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.project_name}-trail"&lt;/span&gt;
  &lt;span class="nx"&gt;s3_bucket_name&lt;/span&gt;                &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;include_global_service_events&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;is_multi_region_trail&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="nx"&gt;enable_logging&lt;/span&gt;                &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

  &lt;span class="nx"&gt;event_selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;read_write_type&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"All"&lt;/span&gt;
    &lt;span class="nx"&gt;include_management_events&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;depends_on&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nx"&gt;aws_s3_bucket_policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;aws_s3_bucket_public_access_block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.project_name}-trail"&lt;/span&gt;
    &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"lab"&lt;/span&gt;
    &lt;span class="nx"&gt;ManagedBy&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔹 outputs.tf
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"vpc_id"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_logs_bucket"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bucket&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"cloudtrail_trail_name"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_cloudtrail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"region"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_region&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  &lt;a id="initializing-terraform"&gt;&lt;/a&gt;⚙️ Initializing Terraform in CloudShell
&lt;/h1&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init
terraform validate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your environment is now ready.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="planning-and-applying"&gt;&lt;/a&gt;🚀 Planning and Applying
&lt;/h1&gt;

&lt;p&gt;Preview what Terraform will create:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform plan &lt;span class="nt"&gt;-out&lt;/span&gt; tfplan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply the infrastructure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply tfplan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terraform will deploy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new secure VPC
&lt;/li&gt;
&lt;li&gt;A CloudTrail-ready S3 bucket
&lt;/li&gt;
&lt;li&gt;Encryption + versioning + public access blocks
&lt;/li&gt;
&lt;li&gt;A CloudTrail trail
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  &lt;a id="verifying-the-deployment"&gt;&lt;/a&gt;🔍 Verifying the Deployment
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Check VPC
&lt;/h3&gt;

&lt;p&gt;AWS Console → VPC → Your VPCs → Look for the name &lt;code&gt;tf-security-demo-vpc&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Check S3
&lt;/h3&gt;

&lt;p&gt;Look for:&lt;/p&gt;

&lt;p&gt;✔ Versioning enabled&lt;br&gt;&lt;br&gt;
✔ AES-256 encryption&lt;br&gt;&lt;br&gt;
✔ Public Access Block = ON  &lt;/p&gt;
&lt;h3&gt;
  
  
  Check CloudTrail
&lt;/h3&gt;

&lt;p&gt;AWS Console → CloudTrail → Trails → Your trail should be active&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="cleaning-up-resources"&gt;&lt;/a&gt;🧹 Cleaning Up Resources
&lt;/h1&gt;

&lt;p&gt;Always run this to avoid costs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm with &lt;strong&gt;yes&lt;/strong&gt; when prompted.&lt;/p&gt;

&lt;p&gt;CloudShell removes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudTrail
&lt;/li&gt;
&lt;li&gt;S3 bucket
&lt;/li&gt;
&lt;li&gt;VPC
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  &lt;a id="troubleshooting-tips"&gt;&lt;/a&gt;🛠 Troubleshooting Tips
&lt;/h1&gt;

&lt;h3&gt;
  
  
  ❗ Terraform not found
&lt;/h3&gt;

&lt;p&gt;Install Terraform manually inside CloudShell after running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ❗ Permission denied
&lt;/h3&gt;

&lt;p&gt;Ensure your IAM user has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;S3 bucket creation permissions
&lt;/li&gt;
&lt;li&gt;CloudTrail permissions
&lt;/li&gt;
&lt;li&gt;VPC permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❗ S3 bucket name already exists
&lt;/h3&gt;

&lt;p&gt;Use random suffix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"random_id"&lt;/span&gt; &lt;span class="s2"&gt;"suffix"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;byte_length&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  &lt;a id="final-thoughts"&gt;&lt;/a&gt;🎉 Final Thoughts
&lt;/h1&gt;

&lt;p&gt;You just built:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A secure AWS logging architecture
&lt;/li&gt;
&lt;li&gt;Using Terraform
&lt;/li&gt;
&lt;li&gt;Inside AWS CloudShell
&lt;/li&gt;
&lt;li&gt;Without installing anything locally
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is professional-grade IaC experience—perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud Security
&lt;/li&gt;
&lt;li&gt;DevOps
&lt;/li&gt;
&lt;li&gt;SOC roles
&lt;/li&gt;
&lt;li&gt;Portfolio projects&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>devops</category>
      <category>aws</category>
      <category>terraform</category>
    </item>
    <item>
      <title>🛡️ Building a Cloud Security Dashboard with AWS Athena + QuickSight (Beginner Friendly)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Mon, 29 Dec 2025 11:52:12 +0000</pubDate>
      <link>https://forem.com/ldwit/building-a-cloud-security-dashboard-with-aws-athena-quicksight-beginner-friendly-3pld</link>
      <guid>https://forem.com/ldwit/building-a-cloud-security-dashboard-with-aws-athena-quicksight-beginner-friendly-3pld</guid>
      <description>&lt;h1&gt;
  
  
  ⭐ Why I Built This Project
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;(Project 5 of 6 — Log Analysis &amp;amp; Dashboards with Athena + QuickSight)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of studying cloud security concepts in isolation, I’m using &lt;strong&gt;real job descriptions&lt;/strong&gt; as a roadmap and building hands-on projects that map directly to cloud security, cloud operations, and security engineering roles.&lt;/p&gt;

&lt;p&gt;This 6-part series focuses on practical, resume-ready cloud security skills, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity hardening and MFA enforcement
&lt;/li&gt;
&lt;li&gt;IAM governance and access reviews
&lt;/li&gt;
&lt;li&gt;Continuous monitoring of cloud resources
&lt;/li&gt;
&lt;li&gt;Misconfiguration detection and drift analysis
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log analysis, audit readiness, and evidence gathering&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Guard rails at scale using AWS Organizations + Service Control Policies (SCPs)
&lt;/li&gt;
&lt;li&gt;Threat detection, anomaly monitoring, and incident triage
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each project is designed to reflect &lt;strong&gt;real-world responsibilities&lt;/strong&gt;, not just theoretical learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Project Sequence
&lt;/h2&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1:&lt;/strong&gt; AWS IAM Hardening — strengthening identity boundaries and improving authentication hygiene&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 2:&lt;/strong&gt; Cloud Security Posture Management (CSPM) using &lt;strong&gt;Security Hub + AWS Config&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 3:&lt;/strong&gt; CASB-Like Monitoring with &lt;strong&gt;GuardDuty + CloudTrail&lt;/strong&gt;, focusing on anomalies, delegated admin, and safe threat simulation&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 4:&lt;/strong&gt; Drift Detection with &lt;strong&gt;AWS Config&lt;/strong&gt;, using managed rules, EventBridge routing, tags, and optional remediation&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 5:&lt;/strong&gt; (&lt;em&gt;this project&lt;/em&gt;) — &lt;strong&gt;Log Analysis &amp;amp; Dashboards with Athena + QuickSight&lt;/strong&gt;  &lt;/p&gt;


&lt;h2&gt;
  
  
  🔍 Why This Project Matters
&lt;/h2&gt;

&lt;p&gt;Modern cloud security teams rely heavily on &lt;strong&gt;logs&lt;/strong&gt; they are the single source of truth during an investigation or audit.  &lt;/p&gt;

&lt;p&gt;But raw CloudTrail logs are huge, noisy, and difficult to interpret without the right tools.&lt;/p&gt;

&lt;p&gt;This project teaches you how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralize your CloudTrail logs in S3
&lt;/li&gt;
&lt;li&gt;Query them efficiently using &lt;strong&gt;Amazon Athena&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Build a &lt;strong&gt;real security dashboard&lt;/strong&gt; using &lt;strong&gt;Amazon QuickSight&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Visualize user behavior, anomalies, and region-based activity
&lt;/li&gt;
&lt;li&gt;Identify failed logins, root usage, and high-risk API calls
&lt;/li&gt;
&lt;li&gt;Understand how analysts and cloud security engineers perform &lt;strong&gt;forensics and evidence gathering&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You'll also learn the &lt;strong&gt;practical limitations&lt;/strong&gt; of CloudTrail logs (delayed ingestion, missing fields, errorcode inconsistencies, timestamp parsing issues), and how to design visuals that still work even when the underlying logs aren’t perfect, a genuine real-world skill.&lt;/p&gt;

&lt;p&gt;By the end of this project, you'll have a &lt;strong&gt;portfolio-ready CloudTrail security dashboard&lt;/strong&gt; that demonstrates real account activity, provides security insights, and aligns directly with responsibilities listed in cloud security job descriptions.&lt;/p&gt;



&lt;p&gt;Welcome to a hands-on, beginner-friendly walkthrough of building a &lt;strong&gt;Cloud Security Dashboard&lt;/strong&gt; using three AWS services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CloudTrail&lt;/strong&gt; → captures account activity
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Athena&lt;/strong&gt; → queries CloudTrail logs using SQL
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;QuickSight&lt;/strong&gt; → visualizes security events
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Along the way, I’ll share real troubleshooting moments, beginner tips, and cost-saving advice because learning AWS should be fun &lt;em&gt;and&lt;/em&gt; affordable.&lt;/p&gt;


&lt;h1&gt;
  
  
  Table of Contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What You’ll Build&lt;/li&gt;
&lt;li&gt;Prerequisites &amp;amp; Cost Awareness&lt;/li&gt;
&lt;li&gt;Step 1 — Enable CloudTrail Logging&lt;/li&gt;
&lt;li&gt;Step 2 — Verify CloudTrail Logs in S3&lt;/li&gt;
&lt;li&gt;Step 3 — Set Up Athena&lt;/li&gt;
&lt;li&gt;Step 4 — Create the External CloudTrail Table&lt;/li&gt;
&lt;li&gt;Step 5 — Repair Partitions &amp;amp; Validate Data&lt;/li&gt;
&lt;li&gt;Step 6 — Run Security SQL Queries in Athena&lt;/li&gt;
&lt;li&gt;Step 7 — Build the QuickSight Dashboard&lt;/li&gt;
&lt;li&gt;Step 8 — Publish &amp;amp; Share Your Dashboard&lt;/li&gt;
&lt;li&gt;Step 9 — Cleanup &amp;amp; Cost Optimization&lt;/li&gt;
&lt;li&gt;Troubleshooting&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;


&lt;h1&gt;
  
  
  &lt;a id="intro"&gt;&lt;/a&gt;1. Introduction
&lt;/h1&gt;

&lt;p&gt;Cloud security can feel overwhelming when you're new. AWS has logs everywhere, alerts everywhere, and tools everywhere. But once you learn how to connect a few core services, you unlock something powerful:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;You can &lt;em&gt;see&lt;/em&gt; what’s happening inside your AWS account.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this project, you'll turn raw CloudTrail logs into a visual dashboard showing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Failed console login attempts
&lt;/li&gt;
&lt;li&gt;Root account activity
&lt;/li&gt;
&lt;li&gt;API usage by region
&lt;/li&gt;
&lt;li&gt;Top users making API calls
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And you'll do it without needing expensive tools.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="whatyoullbuild"&gt;&lt;/a&gt;2. What You’ll Build
&lt;/h1&gt;

&lt;p&gt;By the end, you’ll have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working &lt;strong&gt;CloudTrail → S3 → Athena → QuickSight&lt;/strong&gt; pipeline
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;security dashboard&lt;/strong&gt; with four visuals
&lt;/li&gt;
&lt;li&gt;Saved queries to help you think like a cloud security engineer
&lt;/li&gt;
&lt;li&gt;A repeatable workflow you can show in interviews or your portfolio
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And yes, this entire project stays within free or very low-cost AWS usage.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="prereqs"&gt;&lt;/a&gt;3. Prerequisites &amp;amp; Cost Awareness
&lt;/h1&gt;
&lt;h3&gt;
  
  
  You will need:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account
&lt;/li&gt;
&lt;li&gt;IAM permissions to use CloudTrail, S3, Athena, and QuickSight
&lt;/li&gt;
&lt;li&gt;A region where QuickSight is supported
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Cost Notes (Important)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CloudTrail&lt;/strong&gt;: 1 trail recording management events is free
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3 storage&lt;/strong&gt;: pennies for logs
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Athena&lt;/strong&gt;: ~$5 per TB scanned (our dataset is tiny—cost is near $0)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;QuickSight&lt;/strong&gt;: SPICE storage has a generous free tier
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Pro Tip:&lt;/strong&gt; Delete Athena query results and disable CloudTrail when finished (covered in Cleanup).&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="step1"&gt;&lt;/a&gt;4. Step 1 — Enable CloudTrail Logging
&lt;/h1&gt;

&lt;p&gt;If you haven't already:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;CloudTrail&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Trails → Create Trail&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Management events&lt;/strong&gt; = Read/Write&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage location&lt;/strong&gt; = new S3 bucket&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CloudTrail will begin writing log files to S3 in about 5–10 minutes.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="step2"&gt;&lt;/a&gt;5. Step 2 — Verify CloudTrail Logs in S3
&lt;/h1&gt;

&lt;p&gt;Navigate to the bucket you created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://your-cloudtrail-bucket/AWSLogs/ACCOUNT-ID/CloudTrail/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside you should see folders named by region and date, such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;us-east-1/2025/12/11/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each folder contains &lt;code&gt;.json.gz&lt;/code&gt; CloudTrail logs.&lt;/p&gt;

&lt;p&gt;If you don’t see them, wait a few minutes or trigger activity in your account (login, create an IAM user, etc.).&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="step3"&gt;&lt;/a&gt;6. Step 3 — Set Up Athena
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ln6394a1oyo7v2xqvn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ln6394a1oyo7v2xqvn8.png" alt=" " width="423" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;Query your data in Athena console&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;Go to &lt;strong&gt;Athena → Query Editor&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose a results location (S3 bucket)&lt;/li&gt;
&lt;li&gt;Create a new database:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;security_logs_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select this database in the left panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5jecbct22ylgladhnyj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5jecbct22ylgladhnyj.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="step4"&gt;&lt;/a&gt;7. Step 4 — Create the External CloudTrail Table
&lt;/h1&gt;

&lt;p&gt;Use this DDL (adjust bucket/account ID):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;EXTERNAL&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;eventversion&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt; &lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
      &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;principalid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;arn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;accountid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;invokedby&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;accesskeyid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;sessioncontext&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
        &lt;span class="n"&gt;attributes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;mfaauthenticated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;creationdate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;sessionissuer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
          &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;principalid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;accountid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventtime&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventsource&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventname&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;awsregion&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;sourceipaddress&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useragent&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;errorcode&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;errormessage&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;requestparameters&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;responseelements&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;additionaleventdata&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;requestid&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventid&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;accountid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventtype&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;apiversion&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;recipientaccountid&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;serviceeventdetails&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;sharedeventid&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;vpcendpointid&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;PARTITIONED&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;year&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="n"&gt;FORMAT&lt;/span&gt; &lt;span class="n"&gt;SERDE&lt;/span&gt; &lt;span class="s1"&gt;'com.amazon.emr.hive.serde.CloudTrailSerde'&lt;/span&gt;
&lt;span class="n"&gt;STORED&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;INPUTFORMAT&lt;/span&gt; &lt;span class="s1"&gt;'com.amazon.emr.cloudtrail.CloudTrailInputFormat'&lt;/span&gt;
&lt;span class="n"&gt;OUTPUTFORMAT&lt;/span&gt; &lt;span class="s1"&gt;'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'&lt;/span&gt;
&lt;span class="k"&gt;LOCATION&lt;/span&gt; &lt;span class="s1"&gt;'s3://your-cloudtrail-bucket/AWSLogs/&amp;lt;ACCOUNT-ID&amp;gt;/CloudTrail/'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mbrq1m3cmptqxk2j999.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mbrq1m3cmptqxk2j999.png" alt=" " width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;You'll likely need to create a table view to gather specific information.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="k"&gt;REPLACE&lt;/span&gt; &lt;span class="k"&gt;VIEW&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_flattened&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="c1"&gt;-- Core event metadata&lt;/span&gt;
  &lt;span class="n"&gt;eventtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventsource&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;awsregion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;sourceipaddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useragent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;errorcode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;errormessage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;responseelements&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;eventid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="c1"&gt;-- Flattened identity fields&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;type&lt;/span&gt;        &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;useridentity_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;         &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;useridentity_arn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accountid&lt;/span&gt;   &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;useridentity_accountid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;    &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;useridentity_username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;principalid&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;useridentity_principalid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="c1"&gt;-- Additional context (optional but useful for investigations)&lt;/span&gt;
  &lt;span class="n"&gt;eventtype&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;apiversion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;readonly&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;recipientaccountid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;vpcendpointid&lt;/span&gt;

&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nz29v1cqpqz8m8jwmx9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nz29v1cqpqz8m8jwmx9.png" alt=" " width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="step5"&gt;&lt;/a&gt;8. Step 5 — Repair Partitions &amp;amp; Validate Data
&lt;/h1&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;MSCK&lt;/span&gt; &lt;span class="n"&gt;REPAIR&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Athena to scan all folders (regions/dates) and register them.&lt;/p&gt;

&lt;p&gt;Next, verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt; 
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;eventtime&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt; 
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you get data → success!&lt;/p&gt;

&lt;p&gt;If not, check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;S3 bucket path
&lt;/li&gt;
&lt;li&gt;CloudTrail folders
&lt;/li&gt;
&lt;li&gt;IAM permissions for Athena
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  &lt;a id="step6"&gt;&lt;/a&gt;9. Step 6 — Run Security SQL Queries in Athena
&lt;/h1&gt;

&lt;p&gt;Now let’s run some practical security queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9.1 Check event types&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;eventname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;eventname&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells you what kinds of actions occur in your account.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;9.2 Failed Console Login Attempts&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Failed logins often appear with a non-null &lt;code&gt;errorMessage&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;eventtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sourceipaddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errormessage&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;eventname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ConsoleLogin'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;errormessage&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;eventtime&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;9.3 Root Account Activity&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;eventtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eventname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sourceipaddress&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Root'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;eventtime&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any root event is worth noticing.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;9.4 Events by Region&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;awsregion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;awsregion&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;9.5 Top IAM Users by Activity&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;api_calls&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;useridentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;api_calls&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You now have everything you need for your dashboard.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="step7"&gt;&lt;/a&gt;10. Step 7 — Build the QuickSight Dashboard
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2jx5sq0jdffmpe7c2cd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2jx5sq0jdffmpe7c2cd.png" alt=" " width="632" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;QuickSight → Datasets → New Dataset&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Choose &lt;strong&gt;Athena → cloudtrail_logs&lt;/strong&gt; → Import as SPICE.&lt;/p&gt;

&lt;p&gt;Because CloudTrail timestamps sort correctly as strings, you &lt;strong&gt;do not&lt;/strong&gt; need to convert them to date type.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Dashboard Visual 1 — Failed Console Logins&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual type:&lt;/strong&gt; Line chart&lt;br&gt;&lt;br&gt;
&lt;strong&gt;X-axis:&lt;/strong&gt; &lt;code&gt;eventtime&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;eventid (Count)&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Filter:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;eventname = ConsoleLogin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;errormessage is not null&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Dashboard Visual 2 — Root Account Activity&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual type:&lt;/strong&gt; Bar chart&lt;br&gt;&lt;br&gt;
&lt;strong&gt;X-axis:&lt;/strong&gt; &lt;code&gt;eventtime&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;eventid (Count)&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Filter:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;useridentity_type = Root&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Dashboard Visual 3 — Events by AWS Region&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual type:&lt;/strong&gt; Horizontal bar chart&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Y-axis:&lt;/strong&gt; &lt;code&gt;awsregion&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;eventid (Count)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4c5u6l4ugb2uj8mfsy49.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4c5u6l4ugb2uj8mfsy49.png" alt=" " width="726" height="526"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Dashboard Visual 4 — Top Users by API Calls&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual type:&lt;/strong&gt; Vertical bar chart&lt;br&gt;&lt;br&gt;
&lt;strong&gt;X-axis:&lt;/strong&gt; &lt;code&gt;useridentity_username&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Value:&lt;/strong&gt; &lt;code&gt;eventid (Count)&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Filter:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Top N = 10&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your dashboard is complete!&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="step8"&gt;&lt;/a&gt;11. Step 8 — Publish the Dashboard
&lt;/h1&gt;

&lt;p&gt;Click:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Share → Publish Dashboard → Select "All Sheets"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This ensures your entire analysis is shared, not just the first sheet.&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;a id="cleanup"&gt;&lt;/a&gt;12. Step 9 — Cleanup &amp;amp; Cost Optimization
&lt;/h1&gt;

&lt;p&gt;To avoid unnecessary charges:&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Athena&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Delete old query results from its S3 bucket&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;CloudTrail&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Disable logging if this was only for learning
&lt;/li&gt;
&lt;li&gt;Or reduce event types to lower S3 usage
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;QuickSight&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Delete unused datasets to free SPICE capacity
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;S3&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Remove old log folders if no longer needed
&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  &lt;a id="troubleshooting"&gt;&lt;/a&gt;13. Troubleshooting (Beginner-Friendly)
&lt;/h1&gt;

&lt;p&gt;Even with a simple architecture like &lt;strong&gt;CloudTrail → S3 → Athena → QuickSight&lt;/strong&gt;, a few common issues can cause missing data or broken visuals. Here are some troubleshooting tips you can quickly check before diving deeper.&lt;/p&gt;


&lt;h2&gt;
  
  
  - CloudTrail Data Not Appearing in Athena
&lt;/h2&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Cause:&lt;/strong&gt; CloudTrail logs haven’t reached S3 yet or the path doesn’t match the table LOCATION.
&lt;/h4&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Quick Fixes:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Wait 5–10 minutes after enabling CloudTrail.&lt;/li&gt;
&lt;li&gt;Trigger activity in your AWS account (login, create an IAM user, etc.).&lt;/li&gt;
&lt;li&gt;Confirm your S3 path looks like:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://your-bucket/AWSLogs/&amp;lt;ACCOUNT-ID&amp;gt;/CloudTrail/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Re‑run:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;MSCK&lt;/span&gt; &lt;span class="n"&gt;REPAIR&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If no rows appear afterward, the folder structure or bucket path is incorrect.&lt;/p&gt;


&lt;h2&gt;
  
  
  - MSCK REPAIR Succeeds but Queries Return No Results
&lt;/h2&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Cause:&lt;/strong&gt; Athena’s table LOCATION is missing the trailing slash or points to the wrong folder.
&lt;/h4&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Quick Fix:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Make sure LOCATION ends with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.../CloudTrail/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;MSCK&lt;/span&gt; &lt;span class="n"&gt;REPAIR&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;cloudtrail_logs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Athena needs this exact folder structure to identify partitions.&lt;/p&gt;




&lt;h2&gt;
  
  
  - QuickSight SPICE Dataset Shows “No Data”
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Cause:&lt;/strong&gt; SPICE may have ingested an empty or outdated version of your dataset.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Quick Fixes:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Datasets → Refresh SPICE&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If that doesn’t fix it, &lt;strong&gt;delete the dataset&lt;/strong&gt; and recreate it from Athena.&lt;/li&gt;
&lt;li&gt;Verify the dataset preview actually shows rows before building visuals.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  - Visuals Still Show “No Data”
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Most common causes:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Filters are hiding all your data
&lt;/li&gt;
&lt;li&gt;The visual is still referencing an old field
&lt;/li&gt;
&lt;li&gt;The field type was changed and QuickSight isn’t mapping it correctly
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Quick Fixes:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Remove &lt;strong&gt;all filters&lt;/strong&gt;, then re‑add only the ones you need.
&lt;/li&gt;
&lt;li&gt;Re‑add fields to the visual (drag them in fresh).
&lt;/li&gt;
&lt;li&gt;Keep &lt;code&gt;eventtime&lt;/code&gt; as a &lt;strong&gt;string&lt;/strong&gt;—it sorts correctly and avoids parsing issues.
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  - Failed Console Login Events Not Showing
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Cause:&lt;/strong&gt; CloudTrail sometimes logs failed logins using &lt;code&gt;errorMessage&lt;/code&gt; instead of &lt;code&gt;errorCode&lt;/code&gt;.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Fix:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Use this condition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;errormessage is not null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This catches failures reliably.&lt;/p&gt;




&lt;h2&gt;
  
  
  - QuickSight Permissions Errors
&lt;/h2&gt;

&lt;p&gt;If you see errors about S3 access or Athena metadata:&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Quick Fix:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Make sure QuickSight has the following enabled:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Access to Athena&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access to your CloudTrail S3 bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can configure this in:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;QuickSight → Manage QuickSight → Security &amp;amp; Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77iou9n1qt54qzphgwom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77iou9n1qt54qzphgwom.png" alt=" " width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma2gneudtyfainwwgm93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma2gneudtyfainwwgm93.png" alt=" " width="512" height="806"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Advice
&lt;/h2&gt;

&lt;p&gt;If something looks blank:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove filters
&lt;/li&gt;
&lt;li&gt;Refresh SPICE
&lt;/li&gt;
&lt;li&gt;Re-add fields
&lt;/li&gt;
&lt;li&gt;Run a simple table visual to confirm data exists
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most issues in Athena + QuickSight come down to &lt;strong&gt;filters&lt;/strong&gt;, &lt;strong&gt;paths&lt;/strong&gt;, or &lt;strong&gt;SPICE not refreshing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You now have everything you need to keep the pipeline running smoothly!&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;a id="final"&gt;&lt;/a&gt;14. Final Thoughts
&lt;/h1&gt;

&lt;p&gt;You just built a cloud security monitoring workflow used in real organizations.&lt;/p&gt;

&lt;p&gt;You learned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How CloudTrail logs work
&lt;/li&gt;
&lt;li&gt;How to query logs with Athena
&lt;/li&gt;
&lt;li&gt;How to analyze activity using SQL
&lt;/li&gt;
&lt;li&gt;How to build a security dashboard in QuickSight
&lt;/li&gt;
&lt;li&gt;How to troubleshoot common AWS data issues
&lt;/li&gt;
&lt;li&gt;How to optimize costs
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, you now understand &lt;strong&gt;how to observe what's happening inside your AWS account&lt;/strong&gt;, which is a core cloud security skill.&lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;If you publish your own dashboard, have any tips or advice, tag me. I’d love to see it!&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="https://linkedin.com/in/ldwit" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Thanks for reading!  &lt;/p&gt;

</description>
      <category>analytics</category>
      <category>beginners</category>
      <category>security</category>
      <category>aws</category>
    </item>
    <item>
      <title>Black‑Box Web Vulnerability Testing (Nikto, SQL Injection, XSS)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Sun, 28 Dec 2025 13:43:16 +0000</pubDate>
      <link>https://forem.com/ldwit/black-box-web-vulnerability-testing-nikto-sql-injection-xss-1b34</link>
      <guid>https://forem.com/ldwit/black-box-web-vulnerability-testing-nikto-sql-injection-xss-1b34</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Scope &amp;amp; Ethics&lt;/strong&gt;&lt;br&gt;
This article documents testing performed &lt;strong&gt;only&lt;/strong&gt; inside an intentionally vulnerable &lt;strong&gt;Kali Linux class lab&lt;/strong&gt;. All activities were authorized and executed in a controlled environment for educational purposes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;GitHub Repo with Additional Details:&lt;br&gt;
&lt;a href="https://github.com/ldwit/nikto-sqli-xss" rel="noopener noreferrer"&gt;Black-Box Web Vulnerability Testing&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Why This Lab Matters&lt;/li&gt;
&lt;li&gt;Lab Environment &amp;amp; Scope&lt;/li&gt;
&lt;li&gt;Methodology (Black‑Box Approach)&lt;/li&gt;
&lt;li&gt;Phase 1: Network &amp;amp; Host Discovery&lt;/li&gt;
&lt;li&gt;Phase 2: Service Enumeration&lt;/li&gt;
&lt;li&gt;Phase 3: Vulnerability Scanning with Nikto&lt;/li&gt;
&lt;li&gt;Phase 4: SQL Injection Testing&lt;/li&gt;
&lt;li&gt;Phase 5: Cross‑Site Scripting (XSS)&lt;/li&gt;
&lt;li&gt;Findings Summary&lt;/li&gt;
&lt;li&gt;Mitigations &amp;amp; Secure Design Takeaways&lt;/li&gt;
&lt;li&gt;Common Beginner Pitfalls&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why This Lab Matters
&lt;/h2&gt;

&lt;p&gt;Web vulnerabilities are rarely found by jumping straight to exploitation. In practice, testers start with &lt;strong&gt;discovery&lt;/strong&gt;, validate assumptions, and document both &lt;strong&gt;positive and negative results&lt;/strong&gt;. This lab demonstrates that workflow end‑to‑end using three foundational categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nikto&lt;/strong&gt; – server misconfiguration and hygiene&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQL Injection (SQLi)&lt;/strong&gt; – backend trust and input handling failures&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross‑Site Scripting (XSS)&lt;/strong&gt; – client‑side trust and output encoding failures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is &lt;strong&gt;understanding and documentation&lt;/strong&gt;, not weaponization.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lab Environment &amp;amp; Scope
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Operating System:&lt;/strong&gt; Kali Linux (class OVA)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization:&lt;/strong&gt; Testing limited to intentionally vulnerable services inside the lab network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discovered Targets (internal network):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DVWA (Damn Vulnerable Web Application)&lt;/li&gt;
&lt;li&gt;WebGoat&lt;/li&gt;
&lt;li&gt;Additional intentionally vulnerable apps&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Beginner note:&lt;/strong&gt; In real assessments you often don’t know what’s vulnerable. The first win is simply discovering what exists.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Methodology (Black‑Box Approach)
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;black‑box&lt;/strong&gt; test assumes no prior knowledge of the application internals. The workflow used:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identify reachable networks and hosts&lt;/li&gt;
&lt;li&gt;Enumerate open services and versions&lt;/li&gt;
&lt;li&gt;Scan for misconfigurations&lt;/li&gt;
&lt;li&gt;Test application behavior&lt;/li&gt;
&lt;li&gt;Document &lt;strong&gt;what changed&lt;/strong&gt; and &lt;strong&gt;why it matters&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Negative results are documented as carefully as successful ones.&lt;/p&gt;




&lt;h2&gt;
  
  
  Phase 1: Network &amp;amp; Host Discovery
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Identify live hosts on the internal lab network.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Determined local IP and routes&lt;/li&gt;
&lt;li&gt;Performed host discovery on the internal bridge network&lt;/li&gt;
&lt;li&gt;Identified multiple intentionally vulnerable services by hostname&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Beginner note:&lt;/strong&gt; Host discovery prevents wasted effort. Testing the wrong IP is common early on.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Phase 2: Service Enumeration
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Identify what each host is running and where to focus.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enumerated open ports on discovered hosts&lt;/li&gt;
&lt;li&gt;Identified HTTP services and supporting components (web servers, databases)&lt;/li&gt;
&lt;li&gt;Confirmed which apps were best suited for each vulnerability type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Enumeration tells you &lt;em&gt;where&lt;/em&gt; to test, not &lt;em&gt;how&lt;/em&gt; to exploit.&lt;/p&gt;




&lt;h2&gt;
  
  
  Phase 3: Vulnerability Scanning with Nikto
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Target:&lt;/strong&gt; DVWA web service&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tool:&lt;/strong&gt; Nikto&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Nikto checks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Outdated server software&lt;/li&gt;
&lt;li&gt;Missing security headers&lt;/li&gt;
&lt;li&gt;Exposed directories and default files&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Findings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Outdated Apache version&lt;/li&gt;
&lt;li&gt;Missing security headers (X‑Frame‑Options, X‑Content‑Type‑Options)&lt;/li&gt;
&lt;li&gt;Session cookies missing &lt;code&gt;HttpOnly&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Directory indexing enabled&lt;/li&gt;
&lt;li&gt;Authentication endpoint identified&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; These findings don’t “hack” anything—but they dramatically &lt;strong&gt;increase risk&lt;/strong&gt; and often point directly to deeper vulnerabilities.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Phase 4: SQL Injection Testing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initial Test (Negative Result)
&lt;/h3&gt;

&lt;p&gt;The login page returned a generic &lt;strong&gt;“Login failed”&lt;/strong&gt; message regardless of input.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No visible SQL errors&lt;/li&gt;
&lt;li&gt;No behavioral deviation&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why document this?&lt;/strong&gt; Consistent error handling is a &lt;em&gt;defensive control&lt;/em&gt;. Not every endpoint is vulnerable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Pivot to a Better Target
&lt;/h3&gt;

&lt;p&gt;Using enumeration results, SQL Injection testing moved to a &lt;strong&gt;dedicated SQLi module&lt;/strong&gt; designed to demonstrate unsafe input handling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Observed Behavior
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;User‑supplied input directly influenced backend queries&lt;/li&gt;
&lt;li&gt;Multiple records returned where one was expected&lt;/li&gt;
&lt;li&gt;Unauthorized access to user data and database metadata&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Impact Demonstrated
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Exposure of user records&lt;/li&gt;
&lt;li&gt;Disclosure of database schema and version&lt;/li&gt;
&lt;li&gt;Retrieval of password &lt;strong&gt;hashes&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Beginner note:&lt;/strong&gt; The vulnerability isn’t “seeing data”—it’s that &lt;strong&gt;untrusted input controls database logic&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Supplemental Risk Evidence
&lt;/h3&gt;

&lt;p&gt;A representative unsalted MD5 hash was verified as trivially reversible using a public lookup service, demonstrating how &lt;strong&gt;weak hashing compounds SQL Injection risk&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Phase 5: Cross‑Site Scripting (XSS)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Reflected XSS (DVWA)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Baseline test:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plain text input reflected directly into the response&lt;/li&gt;
&lt;li&gt;No HTML output encoding observed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
User input is reflected verbatim, confirming a &lt;strong&gt;Reflected XSS condition&lt;/strong&gt; at low security settings.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Beginner note:&lt;/strong&gt; A popup is not required to prove XSS. Unsafe reflection alone is enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Stored XSS (DVWA)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Baseline storage test:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User comments persisted in the backend&lt;/li&gt;
&lt;li&gt;Content rendered for all users&lt;/li&gt;
&lt;li&gt;Entries remained after page refresh&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why this is critical:&lt;/strong&gt;&lt;br&gt;
Stored XSS affects &lt;em&gt;every user&lt;/em&gt; who views the page, not just the attacker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Root Cause (from Source Review)
&lt;/h3&gt;

&lt;p&gt;Input was escaped for SQL usage but &lt;strong&gt;not encoded for HTML output&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key lesson:&lt;/strong&gt; SQL escaping ≠ XSS protection. Output must be encoded for the browser context.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Findings Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Nikto&lt;/td&gt;
&lt;td&gt;Multiple misconfigurations identified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQL Injection&lt;/td&gt;
&lt;td&gt;Backend query manipulation confirmed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reflected XSS&lt;/td&gt;
&lt;td&gt;Unsafe reflection detected&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stored XSS&lt;/td&gt;
&lt;td&gt;Persistent unsafe rendering confirmed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Mitigations &amp;amp; Secure Design Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;parameterized queries&lt;/strong&gt; (PDO / MySQLi)&lt;/li&gt;
&lt;li&gt;Apply &lt;strong&gt;context‑aware output encoding&lt;/strong&gt; (&lt;code&gt;htmlspecialchars&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Set security headers (&lt;code&gt;HttpOnly&lt;/code&gt;, &lt;code&gt;X‑Frame‑Options&lt;/code&gt;, CSP)&lt;/li&gt;
&lt;li&gt;Avoid weak or unsalted password hashes&lt;/li&gt;
&lt;li&gt;Validate input &lt;em&gt;and&lt;/em&gt; encode output&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Defense‑in‑depth matters:&lt;/strong&gt; No single control is sufficient.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Common Beginner Pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Expecting every input to be vulnerable&lt;/li&gt;
&lt;li&gt;Skipping enumeration and guessing targets&lt;/li&gt;
&lt;li&gt;Confusing SQL escaping with XSS prevention&lt;/li&gt;
&lt;li&gt;Failing to document negative results&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learning to say &lt;strong&gt;“this did not change behavior”&lt;/strong&gt; is a skill.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This lab demonstrated how a structured black‑box approach uncovers vulnerabilities &lt;strong&gt;systematically&lt;/strong&gt;, not magically. By combining discovery, scanning, behavioral testing, and documentation, it’s possible to explain not just &lt;em&gt;what&lt;/em&gt; is vulnerable, but &lt;em&gt;why it matters&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The most important takeaway:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Security testing is about understanding trust boundaries, not memorizing payloads.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Connect
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="//linkedin.com/in/ldwit"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>linux</category>
      <category>webtesting</category>
      <category>parocyber</category>
    </item>
    <item>
      <title>🛡️ AWS Config Drift Detection Lab - Beginner-Friendly Guide</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Sat, 20 Dec 2025 13:46:23 +0000</pubDate>
      <link>https://forem.com/ldwit/aws-config-drift-detection-lab-beginner-friendly-guide-39c8</link>
      <guid>https://forem.com/ldwit/aws-config-drift-detection-lab-beginner-friendly-guide-39c8</guid>
      <description>&lt;h1&gt;
  
  
  ⭐ Why I Built This Project
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;(Project 4 of 6 — Drift Detection with AWS Config)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of studying cloud security concepts in isolation, I’m using &lt;strong&gt;real job descriptions&lt;/strong&gt; as a roadmap and building hands-on projects that map directly to cloud security, cloud operations, and security engineering.&lt;/p&gt;

&lt;p&gt;This 6-part series focuses on practical, resume-ready cloud security skills, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity hardening and MFA enforcement
&lt;/li&gt;
&lt;li&gt;IAM governance and access reviews
&lt;/li&gt;
&lt;li&gt;Continuous monitoring of cloud resources
&lt;/li&gt;
&lt;li&gt;Misconfiguration detection &amp;amp; drift analysis
&lt;/li&gt;
&lt;li&gt;Log analysis, audit readiness, and evidence gathering
&lt;/li&gt;
&lt;li&gt;Guard rails at scale using AWS Organizations + Service Control Policies (SCPs)
&lt;/li&gt;
&lt;li&gt;Threat detection, anomaly monitoring, and incident triage
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each project is designed to reflect &lt;strong&gt;real-world responsibilities&lt;/strong&gt;, not just theoretical learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Project Sequence
&lt;/h2&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1:&lt;/strong&gt; AWS IAM Hardening — strengthening identity boundaries and improving authentication hygiene&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 2:&lt;/strong&gt; Cloud Security Posture Management (CSPM) using &lt;strong&gt;Security Hub + AWS Config&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 3:&lt;/strong&gt; CASB-Like Monitoring with &lt;strong&gt;GuardDuty + CloudTrail&lt;/strong&gt;, focusing on anomalies, delegated admin, and safe threat simulation&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 4:&lt;/strong&gt; (&lt;em&gt;this project&lt;/em&gt;) — &lt;strong&gt;Drift Detection with AWS Config&lt;/strong&gt;, using managed Config rules, scoped evaluations, EventBridge routing, SNS notifications, and optional auto-remediation to detect when cloud resources deviate from approved security baselines  &lt;/p&gt;


&lt;h2&gt;
  
  
  🔐 Why This Progression Matters
&lt;/h2&gt;

&lt;p&gt;Modern cloud security teams approach protection in layers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identity first → Posture second → Threat Detection → Drift Governance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After establishing IAM hygiene (Project 1), posture baselines (Project 2), and threat intel/anomaly detection (Project 3), the next natural step is &lt;strong&gt;detecting when cloud resources drift away from their intended configuration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Drift detection is critical because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many breaches originate from &lt;em&gt;accidental misconfigurations&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Public S3 buckets remain a top cloud security incident
&lt;/li&gt;
&lt;li&gt;Compliance frameworks require continuous configuration monitoring
&lt;/li&gt;
&lt;li&gt;Security teams rely on automated alerts not manual checks
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project simulates a realistic workflow used by cloud security analysts, compliance engineers, and platform security teams by combining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Config managed rules&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scoped evaluations (tags, resource types)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EventBridge event pattern filtering&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SNS notification routing&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional SSM auto-remediation actions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost-safe cleanup practices&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll intentionally make an S3 bucket public, watch AWS detect the drift, trigger an automated alert, and optionally repair the issue automatically... a true end-to-end cloud security workflow.&lt;/p&gt;



&lt;p&gt;A hands‑on walkthrough using &lt;strong&gt;AWS Config&lt;/strong&gt;, &lt;strong&gt;EventBridge&lt;/strong&gt;, and &lt;strong&gt;SNS&lt;/strong&gt; to detect when an S3 bucket becomes &lt;em&gt;public&lt;/em&gt; (a classic example of security drift).  &lt;/p&gt;

&lt;p&gt;This is a fun, friendly, technical guide designed for absolute beginners including troubleshooting from a real-world lab run.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="toc"&gt;&lt;/a&gt;📘 Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction
&lt;/li&gt;
&lt;li&gt;
What Is Drift Detection?
&lt;/li&gt;
&lt;li&gt;
Architecture Overview
&lt;/li&gt;
&lt;li&gt;
Prerequisites &amp;amp; Cost Notes
&lt;/li&gt;
&lt;li&gt;
Step 1 — Create a Config Logs Bucket
&lt;/li&gt;
&lt;li&gt;
Step 2 — Enable AWS Config (S3-Only Setup)
&lt;/li&gt;
&lt;li&gt;
Step 3 — Create the Drift-Test S3 Bucket
&lt;/li&gt;
&lt;li&gt;
Step 4 — Add the AWS Config Rule
&lt;/li&gt;
&lt;li&gt;
Step 5 — Create SNS Topic for Alerts
&lt;/li&gt;
&lt;li&gt;
Step 6 — Create EventBridge Rule
&lt;/li&gt;
&lt;li&gt;
Step 7 — Introduce Drift
&lt;/li&gt;
&lt;li&gt;
Step 8 — Verify Detection &amp;amp; Alerts
&lt;/li&gt;
&lt;li&gt;
Troubleshooting &amp;amp; Gotchas
&lt;/li&gt;
&lt;li&gt;
Cleanup
&lt;/li&gt;
&lt;li&gt;
Final Thoughts
&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  &lt;a id="introduction"&gt;&lt;/a&gt;🔰 Introduction
&lt;/h2&gt;

&lt;p&gt;Cloud environments change fast. Sometimes &lt;em&gt;too&lt;/em&gt; fast — and not always intentionally.&lt;br&gt;&lt;br&gt;
This lab shows you how to detect unwanted changes (drift) using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Config&lt;/strong&gt; → Detects drift
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EventBridge&lt;/strong&gt; → Routes drift events
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon SNS&lt;/strong&gt; → Sends email alerts
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll break an S3 bucket &lt;em&gt;on purpose&lt;/em&gt; and watch AWS alert you.&lt;br&gt;&lt;br&gt;
You'll also see real-world troubleshooting issues I hit along the way and how to fix them.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="drift"&gt;&lt;/a&gt;🌪️ What Is Drift Detection?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Security drift&lt;/strong&gt; happens when a resource moves away from your intended configuration.&lt;br&gt;&lt;br&gt;
Example:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want your S3 bucket private
&lt;/li&gt;
&lt;li&gt;Someone makes it public
&lt;/li&gt;
&lt;li&gt;Drift detected! 🔔
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This lab focuses on detecting when an S3 bucket becomes &lt;strong&gt;publicly accessible&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="architecture"&gt;&lt;/a&gt;🏗️ Architecture Overview
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;High-level flow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You create a &lt;strong&gt;private S3 bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;AWS Config evaluates it using a managed rule
&lt;/li&gt;
&lt;li&gt;You introduce drift (make it public)
&lt;/li&gt;
&lt;li&gt;Config marks it &lt;strong&gt;NON_COMPLIANT&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;EventBridge catches the change
&lt;/li&gt;
&lt;li&gt;SNS sends you an email alert
&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  &lt;a id="prereqs"&gt;&lt;/a&gt;🛠️ Prerequisites &amp;amp; Cost Notes
&lt;/h2&gt;
&lt;h3&gt;
  
  
  You Need:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account
&lt;/li&gt;
&lt;li&gt;Basic IAM permissions:

&lt;ul&gt;
&lt;li&gt;AWSConfigFullAccess
&lt;/li&gt;
&lt;li&gt;S3FullAccess
&lt;/li&gt;
&lt;li&gt;EventBridgeFullAccess
&lt;/li&gt;
&lt;li&gt;SNSFullAccess
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Cost Notes:
&lt;/h3&gt;

&lt;p&gt;AWS Config is &lt;strong&gt;not fully free-tier&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
To keep this project low cost:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;one region&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Track &lt;strong&gt;only S3 resources&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;a single rule&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Delete everything at the end (cleanup section included)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;a id="step1"&gt;&lt;/a&gt;🪣 Step 1 — Create a Config Logs Bucket
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;S3 → Create Bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Name it something like:
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;config-logs-lab-&amp;lt;yourinitials&amp;gt;-123&lt;/code&gt;  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable &lt;strong&gt;Block Public Access&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Leave default encryption on
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  &lt;a id="step2"&gt;&lt;/a&gt;📝 Step 2 — Enable AWS Config (S3-Only)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;AWS Config&lt;/strong&gt; → &lt;strong&gt;Set Up&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Record specific resource types&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AWS::S3::Bucket&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;(Optional but recommended)&lt;/em&gt; &lt;code&gt;AWS::S3::AccountPublicAccessBlock&lt;/code&gt;

&lt;ol&gt;
&lt;li&gt;Set the delivery S3 bucket to the one you created
&lt;/li&gt;
&lt;li&gt;Skip SNS notifications (we’ll create our own later)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;a id="step3"&gt;&lt;/a&gt;🪣 Step 3 — Create the Drift-Test S3 Bucket
&lt;/h2&gt;

&lt;p&gt;Name example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;drift-demo-bucket-&amp;lt;yourinitials&amp;gt;-123&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create the bucket
&lt;/li&gt;
&lt;li&gt;Keep &lt;strong&gt;Block Public Access = ON&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add tag:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Key: Project
Value: ConfigDriftLab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This tag lets us scope the Config rule later.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="step4"&gt;&lt;/a&gt;🧩 Step 4 — Add the AWS Config Rule
&lt;/h2&gt;

&lt;p&gt;Search for the managed rule:&lt;/p&gt;
&lt;h3&gt;
  
  
  ✅ &lt;code&gt;s3-bucket-level-public-access-prohibited&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is the new bucket-level drift rule that detects whether bucket policies or ACLs make the bucket public.&lt;/p&gt;

&lt;p&gt;Set &lt;strong&gt;Scope&lt;/strong&gt; to:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resources with specific tags
&lt;/li&gt;
&lt;li&gt;Key: &lt;code&gt;Project&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Value: &lt;code&gt;ConfigDriftLab&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbp7wrqkop8rhsgdsl6n1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbp7wrqkop8rhsgdsl6n1.png" alt=" " width="800" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjznz62d45vd4514cxcrd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjznz62d45vd4514cxcrd.png" alt=" " width="800" height="85"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="step5"&gt;&lt;/a&gt;📣 Step 5 — Create SNS Topic for Alerts
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;SNS → Topics → Create Topic&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Name: &lt;code&gt;drift-alerts-test-topic&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create
&lt;/li&gt;
&lt;li&gt;Add a subscription:

&lt;ul&gt;
&lt;li&gt;Protocol: &lt;strong&gt;Email&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Endpoint: your email address
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Confirm the email in your inbox&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0u2drgner2sz2bm5cybr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0u2drgner2sz2bm5cybr.png" alt=" " width="574" height="96"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a id="step6"&gt;&lt;/a&gt;🔔 Step 6 — Create EventBridge Rule
&lt;/h2&gt;

&lt;p&gt;This rule listens for AWS Config compliance changes.&lt;/p&gt;

&lt;p&gt;Use this event pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"aws.config"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"detail-type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Config Rules Compliance Change"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"detail"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configRuleName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"s3-bucket-level-public-access-prohibited"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"newEvaluationResult"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"complianceType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"NON_COMPLIANT"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set the &lt;strong&gt;Target&lt;/strong&gt; = SNS topic you just created.&lt;/p&gt;

&lt;p&gt;If needed, re-add the target so EventBridge automatically updates the SNS policy.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyymgbywxcs27nk4t8onf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyymgbywxcs27nk4t8onf.png" alt=" " width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k01lualadcs59yoz0jr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k01lualadcs59yoz0jr.png" alt=" " width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step7"&gt;&lt;/a&gt;💥 Step 7 — Introduce Drift (Make the Bucket Public)
&lt;/h2&gt;

&lt;p&gt;To simulate drift:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disable &lt;strong&gt;Block Public Access&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add a public bucket policy:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PublicRead"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::drift-demo-bucket-&amp;lt;yourinitials&amp;gt;-123/*"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AWS Config will soon detect this change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzwt4c1m9batlyi46je5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzwt4c1m9batlyi46je5.png" alt=" " width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step8"&gt;&lt;/a&gt;📨 Step 8 — Verify Drift Detection &amp;amp; Alerts
&lt;/h2&gt;

&lt;p&gt;You should see:&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS Config → Rule Status:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;NON_COMPLIANT 🔴&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  EventBridge → Monitoring:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Invocations &amp;gt; 0&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SNS Email →
&lt;/h3&gt;

&lt;p&gt;Check inbox &lt;strong&gt;and spam folder&lt;/strong&gt; (real story from this lab 😅)&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="troubleshooting"&gt;&lt;/a&gt;🧰 Troubleshooting &amp;amp; Gotchas (Real Lab Issues)
&lt;/h2&gt;

&lt;p&gt;This section includes &lt;strong&gt;both a narrative + clean reference list&lt;/strong&gt;, based on actual problems encountered while building this project.&lt;/p&gt;




&lt;h3&gt;
  
  
  🧵 &lt;strong&gt;Narrative: What Actually Broke &amp;amp; How I Fixed It&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. SNS Never Delivered the Alert
&lt;/h4&gt;

&lt;p&gt;Turns out the SNS topic had the &lt;strong&gt;default policy&lt;/strong&gt;, which does NOT allow EventBridge to publish messages.&lt;/p&gt;

&lt;p&gt;Fix:&lt;br&gt;&lt;br&gt;
I added this to the SNS Access Policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow_EventBridge_Publish"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"events.amazonaws.com"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SNS:Publish"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:sns:us-east-1:&amp;lt;account-id&amp;gt;:drift-alerts-test-topic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ArnEquals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"aws:SourceArn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:events:us-east-1:&amp;lt;account-id&amp;gt;:rule/aws-config-drift-to-sns"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. The First Alert Went to Spam
&lt;/h4&gt;

&lt;p&gt;SNS emails come from:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;no-reply@sns.amazonaws.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I marked it as &lt;strong&gt;Not Spam&lt;/strong&gt; so future alerts land correctly.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Config Rule Name Mismatch
&lt;/h4&gt;

&lt;p&gt;AWS updated the naming of S3 Config rules.&lt;br&gt;&lt;br&gt;
The correct one is:&lt;/p&gt;

&lt;p&gt;✔ &lt;code&gt;s3-bucket-level-public-access-prohibited&lt;/code&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📋 &lt;strong&gt;Clean Troubleshooting Checklist&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No email alert&lt;/td&gt;
&lt;td&gt;Confirm SNS subscription is &lt;strong&gt;Confirmed&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EventBridge not firing&lt;/td&gt;
&lt;td&gt;Check &lt;strong&gt;Monitoring&lt;/strong&gt; tab for &lt;strong&gt;Matches&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Invalid pattern&lt;/td&gt;
&lt;td&gt;Temporarily test with &lt;code&gt;{ "source": ["aws.config"] }&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SNS access denied&lt;/td&gt;
&lt;td&gt;Add EventBridge → SNS publish policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alert went to spam&lt;/td&gt;
&lt;td&gt;Mark “Not Spam”&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No event emitted&lt;/td&gt;
&lt;td&gt;Ensure compliance changed from COMPLIANT → NON_COMPLIANT&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;a id="cleanup"&gt;&lt;/a&gt;🧹 Cleanup (Avoid Costs!)
&lt;/h2&gt;

&lt;p&gt;Delete in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Drift S3 bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Config rule&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stop Configuration Recorder&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete delivery channel&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete Config logs bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete EventBridge rule&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete SNS topic &amp;amp; subscription&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete IAM roles used for remediation (if any)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This ensures AWS Config stops billing you.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="final"&gt;&lt;/a&gt;🎉 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;You just built:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drift detection
&lt;/li&gt;
&lt;li&gt;Automated alerting
&lt;/li&gt;
&lt;li&gt;AWS Config recording pipeline
&lt;/li&gt;
&lt;li&gt;Real debugging scenarios
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a perfect beginner‑friendly cloud security project to show on a resume or portfolio.🚀&lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="https://linkedin.com/in/ldwit" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>aws</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🔐 Building an IAM Security Dashboard with Power BI (Beginner-Friendly Walkthrough)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Fri, 19 Dec 2025 17:17:27 +0000</pubDate>
      <link>https://forem.com/ldwit/building-an-iam-security-dashboard-with-power-bi-beginner-friendly-walkthrough-45hd</link>
      <guid>https://forem.com/ldwit/building-an-iam-security-dashboard-with-power-bi-beginner-friendly-walkthrough-45hd</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Build a leadership-ready IAM security dashboard in &lt;strong&gt;Power BI Desktop&lt;/strong&gt; using a simulated IAM dataset you generate yourself.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Audience:&lt;/strong&gt; Beginners transitioning into security analytics&lt;br&gt;&lt;br&gt;
&lt;strong&gt;What you’ll end with:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working &lt;strong&gt;Power BI dashboard (.pbix)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;CSV dataset&lt;/strong&gt; + &lt;strong&gt;Python generator script&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;GitHub repo&lt;/strong&gt; with clear structure + screenshots
&lt;/li&gt;
&lt;li&gt;A documented “enterprise-style” workflow (Linux + Windows)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ✅ What This Dashboard Answers
&lt;/h2&gt;

&lt;p&gt;This dashboard is designed to help a security analyst answer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are &lt;strong&gt;failed logins&lt;/strong&gt; trending up?&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;users&lt;/strong&gt; have the highest risk?&lt;/li&gt;
&lt;li&gt;What’s the &lt;strong&gt;MFA posture&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Where should we &lt;strong&gt;investigate first&lt;/strong&gt; (user + location)?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is &lt;strong&gt;security reporting maturity&lt;/strong&gt; not just “here are logs.”&lt;/p&gt;




&lt;h2&gt;
  
  
  🧾 Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
1. Project Overview
&lt;/li&gt;
&lt;li&gt;
2. Tools You Need
&lt;/li&gt;
&lt;li&gt;
3. Professional Setup
&lt;/li&gt;
&lt;li&gt;
4. Install VirtualBox on Ubuntu
&lt;/li&gt;
&lt;li&gt;
5. Create the Windows 11 VM
&lt;/li&gt;
&lt;li&gt;
6. Install Power BI Desktop in Windows
&lt;/li&gt;
&lt;li&gt;
7. Create the Project Folder Structure
&lt;/li&gt;
&lt;li&gt;
8. Generate the IAM Dataset (Python)
&lt;/li&gt;
&lt;li&gt;
9. Move the CSV to Windows (OneDrive Method)
&lt;/li&gt;
&lt;li&gt;
10. Import Data into Power BI
&lt;/li&gt;
&lt;li&gt;
11. Create DAX Measures
&lt;/li&gt;
&lt;li&gt;
12. Build the Dashboard Visuals
&lt;/li&gt;
&lt;li&gt;
13. Build “Risk by User” Table (and Fix MFA Count)
&lt;/li&gt;
&lt;li&gt;
14. Export Screenshots and Save the PBIX
&lt;/li&gt;
&lt;li&gt;
15. Push to GitHub (Tokens + Common Errors)
&lt;/li&gt;
&lt;li&gt;
16. Automation Note (Why We Documented It)
&lt;/li&gt;
&lt;li&gt;
17. Final Checklist
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Project Overview
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Output files you’ll have by the end:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;data/iam_security_events.csv&lt;/code&gt; (dataset)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data/generate_data.py&lt;/code&gt; (generator)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data/IAM_Security_Dashboard.pbix&lt;/code&gt; (Power BI dashboard)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;screenshots/&lt;/code&gt; (images of final dashboard)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Tools You Need
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Linux (Ubuntu)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Python 3&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;(Optional) OneDrive sync client or manual upload via browser&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Windows (VM)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Power BI Desktop (free)&lt;/li&gt;
&lt;li&gt;OneDrive (optional but easy)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: &lt;em&gt;You can likely accomplish all of this using Windows. I was already working on my linux machine when structuring this project. This made it easier for me to work with python and push to github. My steps are not law to complete this project.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. Professional Setup
&lt;/h2&gt;

&lt;p&gt;This is the setup many analysts use:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Linux&lt;/strong&gt; for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dataset generation (Python)&lt;/li&gt;
&lt;li&gt;validation&lt;/li&gt;
&lt;li&gt;GitHub version control&lt;/li&gt;
&lt;li&gt;writing documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ &lt;strong&gt;Windows&lt;/strong&gt; for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Power BI Desktop&lt;/li&gt;
&lt;li&gt;visuals + DAX&lt;/li&gt;
&lt;li&gt;exporting &lt;code&gt;.pbix&lt;/code&gt; + screenshots&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Install VirtualBox on Ubuntu
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Install dependencies
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; build-essential dkms linux-headers-&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4.2 Install VirtualBox
&lt;/h3&gt;

&lt;p&gt;Install VirtualBox from Ubuntu repos (beginner friendly):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; virtualbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4.3 Fix common VirtualBox kernel module errors
&lt;/h3&gt;

&lt;p&gt;If you see errors like “Kernel driver not installed”:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /sbin/vboxconfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If it still fails, Secure Boot may be blocking modules. Disable Secure Boot in BIOS/UEFI for lab use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4.4 Fix VMX/KVM conflict (if VirtualBox says VMX root mode error)
&lt;/h3&gt;

&lt;p&gt;Check KVM modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsmod | &lt;span class="nb"&gt;grep &lt;/span&gt;kvm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Temporarily unload (Intel):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;modprobe &lt;span class="nt"&gt;-r&lt;/span&gt; kvm_intel
&lt;span class="nb"&gt;sudo &lt;/span&gt;modprobe &lt;span class="nt"&gt;-r&lt;/span&gt; kvm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(AMD systems use &lt;code&gt;kvm_amd&lt;/code&gt;.)&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Create the Windows 11 VM
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Recommended VM settings (good balance)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; Windows11&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type:&lt;/strong&gt; Microsoft Windows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version:&lt;/strong&gt; Windows 11 (64-bit)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAM:&lt;/strong&gt; 8 GB (minimum 4 GB)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CPU:&lt;/strong&gt; 2 cores (4 if available)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virtual disk:&lt;/strong&gt; &lt;strong&gt;60 GB&lt;/strong&gt;, dynamically allocated (recommended)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5.1 Attach the Windows 11 ISO
&lt;/h3&gt;

&lt;p&gt;If the VM won’t boot, it usually means you forgot to attach the ISO:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → Storage → Empty → Choose ISO&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5.2 Install Windows
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Choose “I don’t have a product key” (fine for labs)&lt;/li&gt;
&lt;li&gt;Complete setup&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Install Power BI Desktop in Windows
&lt;/h2&gt;

&lt;p&gt;Inside the Windows VM:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open browser&lt;/li&gt;
&lt;li&gt;Install &lt;strong&gt;Power BI Desktop&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Confirm it opens successfully&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  7. Create the Project Folder Structure
&lt;/h2&gt;

&lt;p&gt;On Linux, create a clean repo structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/Projects/powerbi-security-dashboard/&lt;span class="o"&gt;{&lt;/span&gt;data,screenshots&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Projects/powerbi-security-dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  8. Generate the IAM Dataset (Python)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  8.1 Create a generator script
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;data/generate_data.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;

&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;USERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;alex.lee@company.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jane.doe@company.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sam.taylor@company.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;morgan.chan@company.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;devon.king@company.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;LOCATIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;US-TX&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;US-CA&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;US-NY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GB-LON&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ZA-JHB&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;EVENT_TYPES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LoginSuccess&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LoginFailure&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFAChallenge&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;AUTH_METHODS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFA&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;risk_for_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mfa_enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Simple rules to make data feel realistic
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LoginFailure&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;mfa_enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Medium&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;High&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;])[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LoginFailure&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Medium&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;])[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFAChallenge&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_rows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rows_per_day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows_per_day&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;USERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;mfa_enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;  &lt;span class="c1"&gt;# mostly enabled
&lt;/span&gt;            &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EVENT_TYPES&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="n"&gt;auth_method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFA&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mfa_enabled&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LoginFailure&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LOCATIONS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;risk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;risk_for_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mfa_enabled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EventDate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UserPrincipalName&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EventType&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;event_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AuthMethod&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;auth_method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFAEnabled&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mfa_enabled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Location&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RiskLevel&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;risk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;out_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data/iam_security_events.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;fieldnames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EventDate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UserPrincipalName&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EventType&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AuthMethod&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MFAEnabled&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Location&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RiskLevel&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeheader&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;generate_rows&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Wrote dataset to &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8.2 Run it
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 data/generate_data.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8.3 Sanity check the CSV
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 5 data/iam_security_events.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  9. Move the CSV to Windows (OneDrive Method)
&lt;/h2&gt;

&lt;p&gt;Because Power BI Desktop runs on Windows, you need your CSV accessible in the VM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option A (Recommended): OneDrive
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Upload &lt;code&gt;data/iam_security_events.csv&lt;/code&gt; to OneDrive (from Linux browser)&lt;/li&gt;
&lt;li&gt;In Windows VM, open OneDrive folder&lt;/li&gt;
&lt;li&gt;Confirm the CSV is synced locally&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;This is common in real environments: Linux generates data; Windows consumes it for reporting.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  10. Import Data into Power BI
&lt;/h2&gt;

&lt;p&gt;In Power BI Desktop (Windows VM):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Home → &lt;strong&gt;Get Data&lt;/strong&gt; → &lt;strong&gt;Text/CSV&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;iam_security_events.csv&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Transform Data&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Confirm types:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;EventDate&lt;/code&gt; = &lt;strong&gt;Date&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MFAEnabled&lt;/code&gt; = &lt;strong&gt;True/False&lt;/strong&gt; (or Boolean)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Close &amp;amp; Apply&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  11. Create DAX Measures
&lt;/h2&gt;

&lt;p&gt;Right-click your table in the Fields pane (example: &lt;code&gt;IAMSecurityEvents&lt;/code&gt;) → &lt;strong&gt;New measure&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  11.1 Total Login Attempts
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Total Login Attempts =
COUNT(IAMSecurityEvents[EventType])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  11.2 Failed Logins
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Failed Logins =
CALCULATE(
    COUNT(IAMSecurityEvents[EventType]),
    IAMSecurityEvents[EventType] = "LoginFailure"
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  11.3 High Risk Events
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;High Risk Events =
CALCULATE(
    COUNT(IAMSecurityEvents[RiskLevel]),
    IAMSecurityEvents[RiskLevel] = "High"
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  11.4 MFA Coverage % (optional but strong)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MFA Coverage % =
DIVIDE(
    CALCULATE(
        COUNT(IAMSecurityEvents[UserPrincipalName]),
        IAMSecurityEvents[MFAEnabled] = TRUE()
    ),
    COUNT(IAMSecurityEvents[UserPrincipalName]),
    0
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Format it as &lt;strong&gt;Percentage&lt;/strong&gt; (Measure tools → Format → Percentage).&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Build the Dashboard Visuals
&lt;/h2&gt;

&lt;h3&gt;
  
  
  12.1 KPI Cards (use &lt;strong&gt;Card&lt;/strong&gt; visual)
&lt;/h3&gt;

&lt;p&gt;Add 4 Card visuals and drop in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Total Login Attempts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Failed Logins&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;High Risk Events&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MFA Coverage %&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Power BI has a “KPI” visual, but for beginner dashboards, &lt;strong&gt;Card visuals&lt;/strong&gt; are simpler and more reliable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  12.2 Line chart (Failed Logins over time)
&lt;/h3&gt;

&lt;p&gt;Use a Line chart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;X-axis: &lt;code&gt;EventDate&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Y-axis: &lt;code&gt;Failed Logins&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  12.3 Bar chart (High risk by location)
&lt;/h3&gt;

&lt;p&gt;Use a Clustered bar chart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Axis: &lt;code&gt;Location&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Values: &lt;code&gt;High Risk Events&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sort descending by High Risk Events.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Build Risk by User Table (and Fix MFA Count)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  13.1 Create the table
&lt;/h3&gt;

&lt;p&gt;Add a &lt;strong&gt;Table&lt;/strong&gt; visual and add these fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;UserPrincipalName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Failed Logins&lt;/code&gt; (measure)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;High Risk Events&lt;/code&gt; (measure)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MFAEnabled&lt;/code&gt; (column)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  13.2 Fix: MFAEnabled shows as “Count”
&lt;/h3&gt;

&lt;p&gt;This happens because Power BI auto-aggregates fields.&lt;/p&gt;

&lt;p&gt;In the table visual:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Values well, click the dropdown next to &lt;code&gt;MFAEnabled&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Change from &lt;strong&gt;Count&lt;/strong&gt; → &lt;strong&gt;First&lt;/strong&gt; (or &lt;strong&gt;Max&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now it will show &lt;strong&gt;TRUE/FALSE&lt;/strong&gt; per user instead of a number.&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: &lt;em&gt;If you have difficulty finding this, like I did... you may also create another measure.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MFA Enabled Status =
FIRSTNONBLANK(
    IAMSecurityEvents[MFAEnabled],
    1
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  13.3 Sort the table for triage
&lt;/h3&gt;

&lt;p&gt;Sort by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;High Risk Events&lt;/code&gt; descending
Then by:&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Failed Logins&lt;/code&gt; descending&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the table investigation-ready.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Export Screenshots and Save the PBIX
&lt;/h2&gt;

&lt;h3&gt;
  
  
  14.1 Save the dashboard
&lt;/h3&gt;

&lt;p&gt;Save the Power BI file as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;data/IAM_Security_Dashboard.pbix&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  14.2 Take screenshots (Windows VM)
&lt;/h3&gt;

&lt;p&gt;Capture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full dashboard view&lt;/li&gt;
&lt;li&gt;Risk by User table close-up&lt;/li&gt;
&lt;li&gt;High risk by location chart&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Save them into your repo folder:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;screenshots/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Tip: name your files so they are easy to locate.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;01-dashboard-overview.png&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;02-risk-by-user.png&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;03-high-risk-by-location.png&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  15. Push to GitHub (Tokens + Common Errors)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  15.1 Initialize repo
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit: Power BI IAM security dashboard"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  15.2 Add remote
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin https://github.com/&amp;lt;your-username&amp;gt;/powerbi-security-dashboard.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  15.3 Push
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Token permissions
&lt;/h3&gt;

&lt;p&gt;Your GitHub token needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;code&gt;repo&lt;/code&gt; scope (classic token)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Common error: “fetch first”
&lt;/h3&gt;

&lt;p&gt;If GitHub repo already has commits (like a README):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull origin main &lt;span class="nt"&gt;--rebase&lt;/span&gt;
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  16. Automation Note (Why We Documented It)
&lt;/h2&gt;

&lt;p&gt;Power BI alerts + Power Automate typically require a &lt;strong&gt;work/school tenant&lt;/strong&gt; and licensing.&lt;/p&gt;

&lt;p&gt;For this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We built the dashboard in Power BI Desktop&lt;/li&gt;
&lt;li&gt;We documented automation as a “production extension”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is realistic: many portfolio builds don’t have enterprise tenancy.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Final Checklist
&lt;/h2&gt;

&lt;p&gt;✅ CSV generated and committed&lt;br&gt;&lt;br&gt;
✅ Power BI report built and saved as &lt;code&gt;.pbix&lt;/code&gt;&lt;br&gt;&lt;br&gt;
✅ Measures working (cards update with filters)&lt;br&gt;&lt;br&gt;
✅ Risk by user table sorted and MFA fixed&lt;br&gt;&lt;br&gt;
✅ Screenshots captured and saved&lt;br&gt;&lt;br&gt;
✅ Repo pushed to GitHub  &lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="//linkedin.com/in/ldwit"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>cybersecurity</category>
      <category>security</category>
      <category>powerfuldevs</category>
    </item>
    <item>
      <title>🛡️ Ethical Hacking Lab Walkthrough: Website Cloning &amp; SMB Enumeration (Beginner-Friendly)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Thu, 18 Dec 2025 12:06:18 +0000</pubDate>
      <link>https://forem.com/ldwit/ethical-hacking-lab-walkthrough-website-cloning-smb-enumeration-beginner-friendly-37k1</link>
      <guid>https://forem.com/ldwit/ethical-hacking-lab-walkthrough-website-cloning-smb-enumeration-beginner-friendly-37k1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Lab Context:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This article documents a controlled, educational cybersecurity lab completed in a &lt;strong&gt;VirtualBox-based Kali Linux environment&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
All techniques demonstrated were performed &lt;strong&gt;only against intentionally vulnerable lab machines&lt;/strong&gt; (DVWA &amp;amp; Metasploitable) and &lt;strong&gt;never against real-world systems&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  📌 Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why I Built This Lab&lt;/li&gt;
&lt;li&gt;Lab Environment Setup&lt;/li&gt;
&lt;li&gt;
Part 1: Website Cloning with SEToolkit

&lt;ul&gt;
&lt;li&gt;Understanding Website Cloning&lt;/li&gt;
&lt;li&gt;SEToolkit Attack Flow&lt;/li&gt;
&lt;li&gt;Captured Credentials &amp;amp; XML Report&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Part 2: SMB Vulnerability Scanning with Enum4Linux

&lt;ul&gt;
&lt;li&gt;Network Discovery with Nmap&lt;/li&gt;
&lt;li&gt;User Enumeration&lt;/li&gt;
&lt;li&gt;NetBIOS &amp;amp; OS Enumeration&lt;/li&gt;
&lt;li&gt;Share Enumeration&lt;/li&gt;
&lt;li&gt;Password Policy Enumeration&lt;/li&gt;
&lt;li&gt;Full Enumeration (-a)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SMB Access &amp;amp; File Upload with smbclient&lt;/li&gt;
&lt;li&gt;Key Security Findings&lt;/li&gt;
&lt;li&gt;Defensive Takeaways&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Why I Built This Lab
&lt;/h2&gt;

&lt;p&gt;This is a part of my Parocyber ethical hacking training. The instructors course design provides opportunities to gain hands-on experience that mirrors &lt;strong&gt;real-world penetration testing workflows&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This lab helped me practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding how phishing attacks work behind the scenes
&lt;/li&gt;
&lt;li&gt;Enumerating SMB services and misconfigurations
&lt;/li&gt;
&lt;li&gt;Reading tool output and translating it into meaningful findings
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything here is framed from a &lt;strong&gt;defender’s mindset&lt;/strong&gt;: learning how attacks work so they can be prevented.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lab Environment Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attacker Machine:&lt;/strong&gt; Kali Linux OVA (VirtualBox)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Targets:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;DVWA (&lt;code&gt;http://dvwa.vm&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Metasploitable (&lt;code&gt;172.17.0.2&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Network:&lt;/strong&gt; Isolated lab network&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Attacker IP:&lt;/strong&gt; &lt;code&gt;10.6.6.1&lt;/code&gt;
&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Part 1: Website Cloning with SEToolkit
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Understanding Website Cloning
&lt;/h3&gt;

&lt;p&gt;Website cloning is a technique used in phishing attacks where a legitimate login page is copied and hosted elsewhere to harvest credentials.&lt;br&gt;&lt;br&gt;
In this lab, the goal is &lt;strong&gt;educational&lt;/strong&gt; to see how credential harvesting works so we can better defend against it.&lt;/p&gt;


&lt;h3&gt;
  
  
  SEToolkit Attack Flow
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Tool:&lt;/strong&gt; Social-Engineer Toolkit (SEToolkit)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Attack Type:&lt;/strong&gt; Credential Harvester → Site Cloner  &lt;/p&gt;

&lt;p&gt;High-level steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clone a login page (&lt;code&gt;http://dvwa.vm&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Host it on the Kali attacker machine&lt;/li&gt;
&lt;li&gt;Capture submitted credentials&lt;/li&gt;
&lt;li&gt;Review the generated report&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A custom redirect file was created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"refresh"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"0; url=http://10.6.6.1/"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fake credentials submitted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Email:&lt;/strong&gt; &lt;a href="mailto:marvelfan@demo.com"&gt;marvelfan@demo.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Password:&lt;/strong&gt; 1234&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Captured Credentials &amp;amp; XML Report
&lt;/h3&gt;

&lt;p&gt;SEToolkit logged the credentials and exported an XML report:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;harvester&amp;gt;&lt;/span&gt;
   URL=http://dvwa.vm
   &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;username=marvelfan@demo.com&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;password=1234&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;Login=Login&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;param&amp;gt;&lt;/span&gt;user_token=...&lt;span class="nt"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/harvester&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This clearly shows how form fields are captured during phishing attacks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 2: SMB Vulnerability Scanning with Enum4Linux
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Discovery with Nmap
&lt;/h3&gt;

&lt;p&gt;A null scan was used (requires root):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sN&lt;/span&gt; 172.17.0.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This revealed the Metasploitable host (&lt;code&gt;172.17.0.2&lt;/code&gt;) with SMB-related ports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;139/tcp&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;445/tcp&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  User Enumeration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;enum4linux &lt;span class="nt"&gt;-U&lt;/span&gt; 172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dozens of local users discovered&lt;/li&gt;
&lt;li&gt;Anonymous SMB sessions allowed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This alone is a &lt;strong&gt;critical misconfiguration&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  NetBIOS &amp;amp; OS Enumeration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;enum4linux &lt;span class="nt"&gt;-n&lt;/span&gt; 172.17.0.2
enum4linux &lt;span class="nt"&gt;-o&lt;/span&gt; 172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key findings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Workgroup: &lt;code&gt;WORKGROUP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;OS: &lt;strong&gt;Samba 3.0.20 (Debian)&lt;/strong&gt; — known vulnerable version&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Share Enumeration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;enum4linux &lt;span class="nt"&gt;-Sv&lt;/span&gt; 172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shares discovered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;print$&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tmp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;opt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IPC$&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ADMIN$&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;tmp&lt;/code&gt; share allowed &lt;strong&gt;anonymous read/write access&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Password Policy Enumeration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;enum4linux &lt;span class="nt"&gt;-P&lt;/span&gt; 172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Findings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minimum password length: &lt;strong&gt;5&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Password complexity: &lt;strong&gt;Disabled&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Account lockout: &lt;strong&gt;None&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This configuration allows easy brute-force attacks.&lt;/p&gt;




&lt;h3&gt;
  
  
  Full Enumeration (-a)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;enum4linux &lt;span class="nt"&gt;-a&lt;/span&gt; 172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This combined all enumeration techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users&lt;/li&gt;
&lt;li&gt;Groups&lt;/li&gt;
&lt;li&gt;Shares&lt;/li&gt;
&lt;li&gt;Password policy&lt;/li&gt;
&lt;li&gt;RID cycling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A full attacker profile of the system was built &lt;strong&gt;without authentication&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  SMB Access &amp;amp; File Upload with smbclient
&lt;/h2&gt;

&lt;p&gt;Listing shares:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;smbclient &lt;span class="nt"&gt;-L&lt;/span&gt; //172.17.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anonymous login succeeded.&lt;/p&gt;

&lt;p&gt;Connecting to the writable share:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;smbclient //172.17.0.2/tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uploading a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;put virus.exe group_work.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The uploaded file appeared in the directory listing, confirming &lt;strong&gt;anonymous write access&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Note: The local file must exist in your current directory before using &lt;code&gt;put&lt;/code&gt;, or the upload will fail.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Further Reading &amp;amp; Full Outputs
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;strong&gt;Full raw command outputs (Enum4Linux, smbclient, SEToolkit)&lt;/strong&gt; are available on my github:&lt;/p&gt;

&lt;p&gt;➡️ &lt;a href="https://github.com/ldwit/websiteClone-smbVulScan" rel="noopener noreferrer"&gt;Website Clone &amp;amp; SMB Vulnerability Scan&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Security Findings
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Phishing pages easily capture credentials if users are unaware&lt;/li&gt;
&lt;li&gt;SMB anonymous access exposes:

&lt;ul&gt;
&lt;li&gt;Users&lt;/li&gt;
&lt;li&gt;OS details&lt;/li&gt;
&lt;li&gt;Writable shares&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Weak password policies enable brute-force attacks&lt;/li&gt;

&lt;li&gt;SMB1 fallback is still enabled (dangerous)&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Defensive Takeaways
&lt;/h2&gt;

&lt;p&gt;To defend against these attacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enforce MFA and phishing-resistant authentication&lt;/li&gt;
&lt;li&gt;Disable anonymous SMB access&lt;/li&gt;
&lt;li&gt;Remove SMB1 support&lt;/li&gt;
&lt;li&gt;Enforce strong password policies&lt;/li&gt;
&lt;li&gt;Restrict share permissions&lt;/li&gt;
&lt;li&gt;Monitor logs for enumeration activity&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This lab reinforced how &lt;strong&gt;small misconfigurations can lead to full system compromise&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
By practicing these techniques in a safe environment, defenders can better recognize, detect, and prevent real-world attacks.&lt;/p&gt;

&lt;p&gt;If you’re learning cybersecurity, labs like this bridge the gap between theory and practice.&lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="//linkedin.com/in/ldwit"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>cloud</category>
      <category>security</category>
      <category>parocyber</category>
    </item>
    <item>
      <title>🛡️ Building a CASB‑Like Threat Monitoring Lab in AWS (Beginner Friendly)</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Wed, 17 Dec 2025 19:59:39 +0000</pubDate>
      <link>https://forem.com/ldwit/building-a-casb-like-threat-monitoring-lab-in-aws-beginner-friendly-4m80</link>
      <guid>https://forem.com/ldwit/building-a-casb-like-threat-monitoring-lab-in-aws-beginner-friendly-4m80</guid>
      <description>&lt;h1&gt;
  
  
  ⭐ Why I Built This Project (Project 3 of 6 — CASB‑Like Monitoring with GuardDuty + CloudTrail)
&lt;/h1&gt;

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

&lt;p&gt;This 6‑part series focuses on practical skills such as:&lt;/p&gt;

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

&lt;p&gt;Each project reflects &lt;strong&gt;real‑world responsibilities&lt;/strong&gt;, not just theoretical learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Project Sequence
&lt;/h2&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1:&lt;/strong&gt; AWS IAM Hardening — strengthening identity boundaries and improving authentication hygiene&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 2:&lt;/strong&gt; Cloud Security Posture Management (CSPM) using &lt;strong&gt;Security Hub + AWS Config&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Part 3:&lt;/strong&gt; (&lt;em&gt;this project&lt;/em&gt;) — &lt;strong&gt;CASB‑Like Monitoring with GuardDuty + CloudTrail&lt;/strong&gt;, focusing on real‑time detection, safe anomaly generation, delegated administrator behavior, and understanding how AWS produces threat intelligence findings&lt;/p&gt;


&lt;h2&gt;
  
  
  🔐 Why This Progression Matters
&lt;/h2&gt;

&lt;p&gt;Modern cloud security teams approach protection in layers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identity first → Posture second → Threat Detection next&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;This lab simulates a lightweight &lt;strong&gt;Cloud Access Security Broker (CASB)&lt;/strong&gt; workflow inside AWS using managed services, allowing you to explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudTrail event logging &amp;amp; integrity
&lt;/li&gt;
&lt;li&gt;GuardDuty findings (sample + real)
&lt;/li&gt;
&lt;li&gt;Safe adversary simulation
&lt;/li&gt;
&lt;li&gt;Region‑based anomaly detection
&lt;/li&gt;
&lt;li&gt;Delegated administrator restrictions
&lt;/li&gt;
&lt;li&gt;Cleanup for cost control
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Table of Contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction
&lt;/li&gt;
&lt;li&gt;
What You Will Build
&lt;/li&gt;
&lt;li&gt;
Prerequisites
&lt;/li&gt;
&lt;li&gt;
Step 1 — Enable CloudTrail With Secure Settings
&lt;/li&gt;
&lt;li&gt;
Step 2 — Enable GuardDuty (Threat Detection)
&lt;/li&gt;
&lt;li&gt;
Step 3 — Generate Safe Test Activity
&lt;/li&gt;
&lt;li&gt;
Step 4 — Review GuardDuty Findings
&lt;/li&gt;
&lt;li&gt;
Step 5 — Cleanup to Avoid Costs
&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;


&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;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.&lt;br&gt;&lt;br&gt;
This beginner‑friendly lab shows how to simulate CASB‑like monitoring using &lt;strong&gt;AWS CloudTrail + GuardDuty&lt;/strong&gt;, while keeping everything &lt;strong&gt;free or extremely low‑cost&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;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.&lt;/p&gt;


&lt;h1&gt;
  
  
  What You Will Build
&lt;/h1&gt;

&lt;p&gt;By the end of this lab you will have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudTrail logging your AWS API activity
&lt;/li&gt;
&lt;li&gt;GuardDuty analyzing logs for threats
&lt;/li&gt;
&lt;li&gt;Sample findings + real findings from safe test events
&lt;/li&gt;
&lt;li&gt;A lightweight, CASB‑like monitoring workflow
&lt;/li&gt;
&lt;li&gt;A clean environment with &lt;strong&gt;no ongoing costs&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;AWS account
&lt;/li&gt;
&lt;li&gt;IAM user or role with admin‑level permissions
&lt;/li&gt;
&lt;li&gt;A single region chosen for the lab (recommended: &lt;code&gt;us-east-1&lt;/code&gt;)
&lt;/li&gt;
&lt;li&gt;Optional: AWS CLI installed&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Step 1 — Enable CloudTrail With Secure Settings
&lt;/h1&gt;

&lt;p&gt;CloudTrail records API activity across your AWS account. It’s the backbone for detection and threat monitoring.&lt;/p&gt;
&lt;h2&gt;
  
  
  ✅ Create a CloudTrail Trail
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;CloudTrail → Trails → Create trail&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Name your trail:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   casb-guardduty-lab-trail
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create a new S3 bucket for logs
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manually enable&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SSE‑KMS encryption&lt;/strong&gt; (AWS managed key)
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Log file validation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;🔎 Many beginners miss this — CloudTrail does NOT always enable SSE-KMS or validation by default depending on UI version.&lt;br&gt;&lt;br&gt;
These settings add integrity and confidentiality protections to your logs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmffdmtsp2wzpgiepa2ot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmffdmtsp2wzpgiepa2ot.png" alt=" " width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Step 2 — Enable GuardDuty (Threat Detection)
&lt;/h1&gt;

&lt;p&gt;GuardDuty analyzes CloudTrail logs, VPC Flow Logs, and DNS logs for suspicious or malicious activity.&lt;/p&gt;
&lt;h2&gt;
  
  
  ✅ Enable GuardDuty
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;GuardDuty&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Enable GuardDuty&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If GuardDuty creates a &lt;strong&gt;Delegated Administrator&lt;/strong&gt;, note it for cleanup later&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You now have threat detection running automatically.&lt;/p&gt;


&lt;h1&gt;
  
  
  Step 3 — Generate Safe Test Activity
&lt;/h1&gt;

&lt;p&gt;To make this a real learning experience, you’ll generate &lt;strong&gt;safe&lt;/strong&gt; events that CloudTrail and GuardDuty can analyze.&lt;/p&gt;
&lt;h3&gt;
  
  
  🔹 Option A - Generate AWS Sample Findings
&lt;/h3&gt;

&lt;p&gt;In GuardDuty:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;strong&gt;Actions&lt;/strong&gt; menu
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Generate sample findings&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These simulated attacks help you practice incident triage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28ixzz18sdfl8n8iz56n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28ixzz18sdfl8n8iz56n.png" alt=" " width="732" height="783"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  🔹 Option B - Generate Real CloudTrail Events
&lt;/h3&gt;
&lt;h3&gt;
  
  
  1. Console Login Events
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Log out and back into the AWS console
&lt;/li&gt;
&lt;li&gt;Create a test IAM user and intentionally fail login attempts
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These appear as &lt;code&gt;ConsoleLogin&lt;/code&gt; events in CloudTrail.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Activity From an Unusual Region
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Switch from your home region to &lt;code&gt;eu-west-1&lt;/code&gt; or &lt;code&gt;ap-southeast-1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Open services or start to create resources (cancel before provisioning)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CloudTrail logs these actions with the region included.&lt;/p&gt;


&lt;h1&gt;
  
  
  Step 4 — Review GuardDuty Findings
&lt;/h1&gt;

&lt;p&gt;Now you get to see your CASB‑like visibility in action.&lt;/p&gt;
&lt;h3&gt;
  
  
  🔍 View All Findings
&lt;/h3&gt;

&lt;p&gt;Go to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GuardDuty → Findings&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You may see findings such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;UnauthorizedAccess:IAMUser/ConsoleLogin&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recon:EC2/PortProbe&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AnomalousBehavior&lt;/strong&gt; findings for unusual logins
&lt;/li&gt;
&lt;li&gt;Sample simulated threats such as:

&lt;ul&gt;
&lt;li&gt;IAM compromise sequences
&lt;/li&gt;
&lt;li&gt;EC2 compromise
&lt;/li&gt;
&lt;li&gt;Kubernetes or ECS compromise
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If GuardDuty detects unusual database access, you may see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A user successfully logged into an RDS database in an unusual way.
Severity: HIGH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These help you understand what real-world threat detection looks like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjl82i504xkk83qwm17yn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjl82i504xkk83qwm17yn.png" alt=" " width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Step 5 — Cleanup to Avoid Costs
&lt;/h1&gt;

&lt;p&gt;This lab is cheap, but not free if left running for days or months.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❗ REQUIRED: Remove Delegated Administrator First
&lt;/h3&gt;

&lt;p&gt;You &lt;strong&gt;cannot&lt;/strong&gt; disable GuardDuty until the delegated admin is removed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;GuardDuty → Settings → Accounts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Disable delegated administrator&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Confirm
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you can safely disable GuardDuty.&lt;/p&gt;




&lt;h3&gt;
  
  
  ✅ Disable GuardDuty
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;GuardDuty → Settings&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Disable GuardDuty&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  ✅ Delete CloudTrail Trail
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;CloudTrail → Trails&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select your trail
&lt;/li&gt;
&lt;li&gt;Delete it
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  ✅ Remove S3 Logs Bucket
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Empty the bucket
&lt;/li&gt;
&lt;li&gt;Delete the bucket
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  ✅ Delete Test IAM User
&lt;/h3&gt;

&lt;p&gt;If you created one for failed login testing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project gives you real hands‑on experience with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logging
&lt;/li&gt;
&lt;li&gt;Threat detection
&lt;/li&gt;
&lt;li&gt;Cloud security monitoring
&lt;/li&gt;
&lt;li&gt;CASB‑like visibility inside AWS
&lt;/li&gt;
&lt;li&gt;Proper cleanup and cost management
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s a strong beginner → intermediate cloud security project you can showcase in a portfolio or LinkedIn post.&lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="https://linkedin.com/in/ldwit" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>security</category>
      <category>beginners</category>
      <category>aws</category>
    </item>
    <item>
      <title>🛡️ Building a Mini Cloud Security Posture Management (CSPM) Lab Using AWS Security Hub + AWS Config</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Wed, 17 Dec 2025 18:15:36 +0000</pubDate>
      <link>https://forem.com/ldwit/building-a-mini-cloud-security-posture-management-cspm-lab-using-aws-security-hub-aws-config-3c8o</link>
      <guid>https://forem.com/ldwit/building-a-mini-cloud-security-posture-management-cspm-lab-using-aws-security-hub-aws-config-3c8o</guid>
      <description>&lt;h2&gt;
  
  
  ⭐ Why I Built This Project
&lt;/h2&gt;

&lt;p&gt;Instead of studying cloud security concepts in isolation (&lt;em&gt;theory only&lt;/em&gt;), I’m using &lt;strong&gt;real job descriptions&lt;/strong&gt; as a roadmap and building hands-on projects that map directly to what employers expect.&lt;/p&gt;

&lt;p&gt;This 6-part series focuses on skills frequently requested in cloud security, cloud operations, and security engineering roles, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity hardening and MFA enforcement
&lt;/li&gt;
&lt;li&gt;IAM governance and access reviews
&lt;/li&gt;
&lt;li&gt;Continuous monitoring of cloud resources
&lt;/li&gt;
&lt;li&gt;Log analysis, audit readiness, and evidence gathering
&lt;/li&gt;
&lt;li&gt;Guardrails at scale using AWS Organizations + Service Control Policies
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each project aims to reflect &lt;strong&gt;real-world responsibilities&lt;/strong&gt;, not just theoretical knowledge.&lt;/p&gt;




&lt;h3&gt;
  
  
  📌 Project Sequence
&lt;/h3&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1&lt;/strong&gt; focused on &lt;strong&gt;AWS IAM Hardening&lt;/strong&gt;, tightening identity boundaries and improving authentication hygiene.  &lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 2&lt;/strong&gt; (&lt;em&gt;this project&lt;/em&gt;) expands into &lt;strong&gt;Cloud Security Posture Management (CSPM)&lt;/strong&gt;, using &lt;strong&gt;AWS Security Hub + AWS Config&lt;/strong&gt; to detect misconfigurations, enforce security standards, and simulate an enterprise multi-account security architecture.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔐 Why This Progression Matters
&lt;/h3&gt;

&lt;p&gt;Modern cloud security teams approach security in layers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identity first → Posture second → Threat detection next.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A hands-on, beginner-friendly guide to setting up Cloud Security Posture Management (CSPM) in AWS, using a real enterprise deployment pattern with AWS Organizations + Delegated Administrator, intentional misconfigurations, CLI exports, troubleshooting, and a final cleanup plan.&lt;/em&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  📘 Table of Contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
Overview: What We’re Building
&lt;/li&gt;
&lt;li&gt;
Architecture: How CSPM Works in the Real World
&lt;/li&gt;
&lt;li&gt;
Prerequisites
&lt;/li&gt;
&lt;li&gt;
Step 1: Prepare AWS Organizations
&lt;/li&gt;
&lt;li&gt;
Step 2: Create &amp;amp; Access the Delegated Admin Account
&lt;/li&gt;
&lt;li&gt;
Step 3: Enable AWS Config Across the Org
&lt;/li&gt;
&lt;li&gt;
Step 4: Enable AWS Security Hub CSPM
&lt;/li&gt;
&lt;li&gt;
Step 5: Validate CSPM Is Working
&lt;/li&gt;
&lt;li&gt;
Step 6: Create Intentional Misconfigurations
&lt;/li&gt;
&lt;li&gt;
Step 7: View &amp;amp; Export Findings
&lt;/li&gt;
&lt;li&gt;
Troubleshooting (Real Errors I Hit &amp;amp; Fixes)
&lt;/li&gt;
&lt;li&gt;
What Not To Do in Production (But OK in This Lab)
&lt;/li&gt;
&lt;li&gt;
Cleanup Steps
&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;a id="overview-what-were-building"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ Overview: What We’re Building
&lt;/h2&gt;

&lt;p&gt;In this lab you’ll build a &lt;strong&gt;mini CSPM&lt;/strong&gt; using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AWS Security Hub CSPM&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AWS Config&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AWS Organizations with a Delegated Administrator&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stand up a &lt;strong&gt;realistic enterprise-style architecture&lt;/strong&gt; (management account + security account).
&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;intentional misconfigurations&lt;/strong&gt; (like a public S3 bucket and open security group).
&lt;/li&gt;
&lt;li&gt;Let &lt;strong&gt;Security Hub CSPM&lt;/strong&gt; detect them.
&lt;/li&gt;
&lt;li&gt;Export findings with the &lt;strong&gt;AWS CLI / CloudShell&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Practice remediation and then &lt;strong&gt;clean everything up&lt;/strong&gt; to control cost.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="architecture-how-cspm-works-in-the-real-world"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ Architecture: How CSPM Works in the Real World
&lt;/h2&gt;

&lt;p&gt;In production, CSPM rarely runs from the same account that owns workloads.&lt;br&gt;&lt;br&gt;
Instead, you usually see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Management Account&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Owns AWS Organizations
&lt;/li&gt;
&lt;li&gt;Enables services like Security Hub + Config at the org level
&lt;/li&gt;
&lt;li&gt;Assigns a &lt;strong&gt;delegated administrator&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Delegated Admin Account&lt;/strong&gt; (Security / Audit account)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs &lt;strong&gt;Security Hub CSPM&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Aggregates findings from all member accounts
&lt;/li&gt;
&lt;li&gt;Sees the overall security posture
&lt;/li&gt;
&lt;li&gt;Drives remediation across the org
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s exactly the pattern we’ll follow here.&lt;/p&gt;



&lt;p&gt;&lt;a id="prerequisites"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3️⃣ Prerequisites
&lt;/h2&gt;

&lt;p&gt;You’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS Organization already created (or permission to create one).
&lt;/li&gt;
&lt;li&gt;Permission to create a &lt;strong&gt;new member account&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Basic understanding of:

&lt;ul&gt;
&lt;li&gt;IAM users / roles
&lt;/li&gt;
&lt;li&gt;S3 buckets
&lt;/li&gt;
&lt;li&gt;EC2 security groups
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Either:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS CloudShell&lt;/strong&gt; (recommended), or
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI&lt;/strong&gt; installed on your machine.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This lab assumes a &lt;strong&gt;personal / sandbox&lt;/strong&gt; environment, &lt;em&gt;not&lt;/em&gt; production.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-1-prepare-aws-organizations"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  4️⃣ Step 1: Prepare AWS Organizations
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;management account&lt;/strong&gt;, open &lt;strong&gt;AWS Organizations&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;If Organizations is not enabled, enable it.
&lt;/li&gt;
&lt;li&gt;(Optional but nice) Create a simple structure:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Root
    └── Security OU
         └── cspm-admin-account
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We’ll put our delegated admin account in the &lt;strong&gt;Security OU&lt;/strong&gt; later.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-2-create--access-the-delegated-admin-account"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  5️⃣ Step 2: Create &amp;amp; Access the Delegated Admin Account
&lt;/h2&gt;
&lt;h3&gt;
  
  
  5.1 Create a new member account
&lt;/h3&gt;

&lt;p&gt;From the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Organizations → Accounts → Add an AWS account → Create an AWS account&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Example values:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Account name: cspm-admin-account
   Email: yourname+securityhub@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Place it into your &lt;strong&gt;Security OU&lt;/strong&gt; if you created one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This new account will become the &lt;strong&gt;Security Hub delegated administrator&lt;/strong&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  5.2 Assign the delegated administrator
&lt;/h3&gt;

&lt;p&gt;Still in the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Security Hub&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Settings → Accounts&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Designate a delegated administrator&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;cspm-admin-account&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Security Hub will now treat that account as the &lt;strong&gt;org-wide CSPM brain&lt;/strong&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  5.3 Switch role into the delegated admin account
&lt;/h3&gt;

&lt;p&gt;You normally don’t log into member accounts directly as root.&lt;br&gt;&lt;br&gt;
Instead, use &lt;strong&gt;Switch Role&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Log in to the management account as an &lt;strong&gt;IAM admin user&lt;/strong&gt; (not root).
&lt;/li&gt;
&lt;li&gt;In the top-right, choose your username → &lt;strong&gt;Switch role&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Account ID&lt;/strong&gt;: of &lt;code&gt;cspm-admin-account&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; OrganizationAccountAccessRole
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optionally give the role a display name and a color (e.g., &lt;code&gt;CSPM-Admin&lt;/code&gt; in blue).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You are now operating &lt;em&gt;inside&lt;/em&gt; the delegated admin account with full admin rights.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-3-enable-aws-config-across-the-org"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  6️⃣ Step 3: Enable AWS Config Across the Org
&lt;/h2&gt;

&lt;p&gt;AWS Config records &lt;strong&gt;configuration history&lt;/strong&gt; and feeds data to Security Hub.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;AWS Config → Settings / Get started&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource recording&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Choose &lt;strong&gt;Record all resources supported in this region&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3 bucket for configuration history &amp;amp; snapshots&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Create or choose a bucket (defaults are fine for this lab):

&lt;ul&gt;
&lt;li&gt;ACLs disabled
&lt;/li&gt;
&lt;li&gt;Versioning off
&lt;/li&gt;
&lt;li&gt;SSE-S3 encryption on
&lt;/li&gt;
&lt;li&gt;Bucket Key enabled
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Skip SNS notifications to avoid alert noise for the project.
&lt;/li&gt;
&lt;li&gt;Save your settings and make sure &lt;strong&gt;recording is ON&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 In a larger environment you might scope to specific resource types for cost, but for a mini CSPM lab recording all resources gives you a more realistic feel.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;&lt;a id="step-4-enable-aws-security-hub-cspm"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  7️⃣ Step 4: Enable AWS Security Hub CSPM
&lt;/h2&gt;

&lt;p&gt;Still in the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Security Hub&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Get started → Configure Security Hub CSPM&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;You’ll be asked for:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Home Region&lt;/strong&gt; (choose the region you’ll mainly work in).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account Number&lt;/strong&gt; (enter the management account’s 12‑digit ID).
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Accept the prompt to &lt;strong&gt;create/update the delegation policy&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once enabled, Security Hub CSPM will automatically turn on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Foundational Security Best Practices v1.0.0&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CIS AWS Foundations Benchmark v1.2.0&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You now have an &lt;strong&gt;org-level CSPM engine&lt;/strong&gt;, with &lt;code&gt;cspm-admin-account&lt;/code&gt; as the delegated administrator.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-5-validate-cspm-is-working"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  8️⃣ Step 5: Validate CSPM Is Working (Delegated Admin View)
&lt;/h2&gt;

&lt;p&gt;Switch role back into the &lt;strong&gt;cspm-admin-account&lt;/strong&gt; (delegated admin).&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;Security Hub&lt;/strong&gt; and check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dashboard&lt;/strong&gt; – You should see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Number of controls&lt;/li&gt;
&lt;li&gt;Findings over time&lt;/li&gt;
&lt;li&gt;A breakdown of threats / exposure / resources&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security standards&lt;/strong&gt; – Confirm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;AWS Foundational Security Best Practices v1.0.0&lt;/em&gt; is &lt;strong&gt;Enabled&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;CIS AWS Foundations Benchmark v1.2.0&lt;/em&gt; is &lt;strong&gt;Enabled&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Settings → Accounts&lt;/strong&gt; – Should say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“This account is the delegated administrator for your organization.”&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If all of that looks good, CSPM is officially &lt;strong&gt;online&lt;/strong&gt;. 🎉&lt;/p&gt;



&lt;p&gt;&lt;a id="step-6-create-intentional-misconfigurations"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  9️⃣ Step 6: Create Intentional Misconfigurations
&lt;/h2&gt;

&lt;p&gt;Now the fun part: we’ll create a few misconfigurations &lt;strong&gt;on purpose&lt;/strong&gt; in the delegated admin account so Security Hub can yell at us.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Do this only in a sandbox environment.&lt;br&gt;&lt;br&gt;
Never create intentional vulnerabilities in production.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h3&gt;
  
  
  9.1 Misconfig #1 – Public S3 bucket
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;strong&gt;S3&lt;/strong&gt;, choose &lt;strong&gt;Create bucket&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Name it something like: &lt;code&gt;cspm-test-bucket-001&lt;/code&gt;.
&lt;/li&gt;
&lt;li&gt;Region: same as your Security Hub home region.
&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Block Public Access settings for this bucket&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Uncheck &lt;strong&gt;Block all public access&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Acknowledge the scary warning.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;(Optional but loud) Add a bucket policy that allows public reads.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Security Hub should eventually trigger a finding similar to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Amazon S3 Block Public Access was disabled for the S3 bucket cspm-test-bucket-001.”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can even add a &lt;strong&gt;comment&lt;/strong&gt; in the finding like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Will triage and disable public access.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8q5o1fqvd4aotwfhzhzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8q5o1fqvd4aotwfhzhzk.png" alt=" " width="800" height="113"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  9.2 Misconfig #2 – Open security group
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;EC2 → Security Groups → Create security group&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Name: &lt;code&gt;cspm-open-ssh-test&lt;/code&gt;.
&lt;/li&gt;
&lt;li&gt;Inbound rule:

&lt;ul&gt;
&lt;li&gt;Type: &lt;strong&gt;SSH&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Port: &lt;code&gt;22&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Source: &lt;code&gt;0.0.0.0/0&lt;/code&gt; (anywhere)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Security Hub will flag this with an EC2-related control (e.g., “Security groups should not allow unrestricted SSH access”).&lt;/p&gt;


&lt;h3&gt;
  
  
  9.3 Misconfig #3 – Root account use (already flagged)
&lt;/h3&gt;

&lt;p&gt;If you’ve logged in or used the root account recently, Security Hub may already show findings like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;“The API ConsoleLogin was invoked using root credentials.”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;“The API DescribeRegions was invoked using root credentials.”&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are a great example of how CSPM watches for bad &lt;strong&gt;identity hygiene&lt;/strong&gt;, not just network or S3 misconfigurations.&lt;/p&gt;



&lt;p&gt;&lt;a id="step-7-view--export-findings"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🔟 Step 7: View &amp;amp; Export Findings
&lt;/h2&gt;
&lt;h3&gt;
  
  
  10.1 View findings in the console
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;delegated admin account&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security Hub → &lt;strong&gt;Findings&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Use filters such as:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product name&lt;/strong&gt;: &lt;code&gt;Security Hub&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Severity label&lt;/strong&gt;: &lt;code&gt;LOW&lt;/code&gt;, &lt;code&gt;MEDIUM&lt;/code&gt;, or &lt;code&gt;HIGH&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click on a finding for details:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Title &amp;amp; Description&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource&lt;/strong&gt; (e.g., S3 bucket ARN)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Severity&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remediation&lt;/strong&gt; (often linked AWS docs)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notes / Comments&lt;/strong&gt; (you can add your own)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Dashboard also gives you a nice view of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threats
&lt;/li&gt;
&lt;li&gt;Exposure
&lt;/li&gt;
&lt;li&gt;Number of resources
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Findings by Region&lt;/strong&gt; and severity breakdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Example Snippets&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjfsof6piox63m1g3foma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjfsof6piox63m1g3foma.png" alt=" " width="800" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpeeck745utcxn2xeo2hi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpeeck745utcxn2xeo2hi.png" alt=" " width="800" height="99"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgz5lh91orus0ra09l6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgz5lh91orus0ra09l6l.png" alt=" " width="527" height="182"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  10.2 Export findings with AWS CLI (CloudShell)
&lt;/h3&gt;

&lt;p&gt;For this project, we’ll use &lt;strong&gt;AWS CloudShell&lt;/strong&gt; so we don’t have to store credentials locally.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;While still in the &lt;strong&gt;delegated admin account&lt;/strong&gt;, open &lt;strong&gt;CloudShell&lt;/strong&gt; from the console.
&lt;/li&gt;
&lt;li&gt;Verify your identity:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Export findings to a JSON file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   aws securityhub get-findings      &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1      &lt;span class="nt"&gt;--output&lt;/span&gt; json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; securityhub-findings.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;List the file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; securityhub-findings.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2c65j5qhncdn2cz4r25.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2c65j5qhncdn2cz4r25.png" alt=" " width="606" height="46"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  10.3 Small JSON example
&lt;/h3&gt;

&lt;p&gt;Here’s a safe, shortened snippet similar to what you’ll see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Findings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Amazon S3 Block Public Access was disabled"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Block Public Access settings were disabled for bucket cspm-test-bucket-001."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Severity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"Label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"LOW"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::cspm-test-bucket-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AwsS3Bucket"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a real environment, this JSON could be fed into SIEMs, dashboards, or automation workflows.&lt;/p&gt;




&lt;p&gt;&lt;a id="troubleshooting-real-errors-i-hit--fixes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣1️⃣ Troubleshooting (Real Errors I Hit &amp;amp; Fixes)
&lt;/h2&gt;

&lt;p&gt;I ran into several very real-world errors while building this.&lt;br&gt;&lt;br&gt;
Here’s what they meant and how they were resolved.&lt;/p&gt;


&lt;h3&gt;
  
  
  🔧 “The delegated administration for SecurityHub CSPM was not fully configured…”
&lt;/h3&gt;

&lt;p&gt;Variations included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;“…is already a member under another account for these regions…”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;“You specified an account that doesn't exist…”&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Old Security Hub Org configuration or delegated admin metadata existed from a previous project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove any existing delegated admin for Security Hub.
&lt;/li&gt;
&lt;li&gt;Disable trusted access for Security Hub under &lt;strong&gt;Organizations → Services&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Re-run the CSPM setup wizard and assign the new &lt;code&gt;cspm-admin-account&lt;/code&gt; as delegated admin.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  🔧 “You cannot register the management account as delegated administrator”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By design, the &lt;strong&gt;management account cannot also be the delegated admin&lt;/strong&gt; for CSPM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;separate member account&lt;/strong&gt; (&lt;code&gt;cspm-admin-account&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;Use that as the delegated admin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lesson: this project accidentally forced me into the correct enterprise pattern. 😄&lt;/p&gt;


&lt;h3&gt;
  
  
  🔧 CLI error: explicit deny in a Service Control Policy (SCP)
&lt;/h3&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AccessDeniedException: ... not authorized to perform: securityhub:GetFindings ...
with an explicit deny in a service control policy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An SCP attached at the Root or OU level explicitly denied Security Hub actions, even though my IAM user had permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the &lt;strong&gt;management account&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Review SCPs attached to the OU / account.
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove the restrictive SCP from the delegated admin account, or
&lt;/li&gt;
&lt;li&gt;Add an exception:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"StringNotEquals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"aws:PrincipalAccount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DELEGATED_ADMIN_ACCOUNT_ID"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Lesson: &lt;strong&gt;SCPs override IAM&lt;/strong&gt;. If an SCP says “no,” nothing else can say “yes.”&lt;/p&gt;




&lt;h3&gt;
  
  
  🔧 “Switch role” option missing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I was logged in as the &lt;strong&gt;root user&lt;/strong&gt;, which doesn’t get the Switch Role option.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an &lt;strong&gt;IAM admin user&lt;/strong&gt; in the management account.
&lt;/li&gt;
&lt;li&gt;Log in as that IAM user instead.
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Switch role&lt;/strong&gt; menu appears in the top-right.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="what-not-to-do-in-production-but-ok-in-this-lab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣2️⃣ What Not To Do in Production (But OK in This Lab)
&lt;/h2&gt;

&lt;p&gt;I intentionally bent a few rules to keep this lab simple.&lt;br&gt;&lt;br&gt;
They’re fine here, but you &lt;strong&gt;should not&lt;/strong&gt; copy them into a real environment.&lt;/p&gt;




&lt;h3&gt;
  
  
  ❌ Long-lived access keys for a CSPM admin user
&lt;/h3&gt;

&lt;p&gt;For testing the CLI, I created an IAM user and access key.&lt;/p&gt;

&lt;p&gt;In production you should instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;AWS IAM Identity Center (SSO)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Or use &lt;strong&gt;STS AssumeRole&lt;/strong&gt; with short-lived credentials
&lt;/li&gt;
&lt;li&gt;Or stick to &lt;strong&gt;CloudShell&lt;/strong&gt;, which gives you ephemeral credentials bound to your console role.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ❌ Creating misconfigurations directly in the security account
&lt;/h3&gt;

&lt;p&gt;In enterprises, the delegated admin account is often &lt;strong&gt;locked down&lt;/strong&gt; and doesn’t host workloads.&lt;/p&gt;

&lt;p&gt;For learning, it was convenient to create test S3 buckets and security groups there.&lt;br&gt;&lt;br&gt;
In production, do this kind of testing in &lt;strong&gt;separate test accounts&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  ❌ Disabling S3 Block Public Access
&lt;/h3&gt;

&lt;p&gt;We temporarily disabled this to generate findings.&lt;br&gt;&lt;br&gt;
In real environments, you usually want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Account-level Block Public Access &lt;strong&gt;ON&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Bucket-level Block Public Access &lt;strong&gt;ON&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Tight bucket policies and IAM least privilege
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="cleanup-steps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣3️⃣ Cleanup Steps
&lt;/h2&gt;

&lt;p&gt;To avoid surprise bills and leave your org clean, run through these steps when you’re done.&lt;/p&gt;




&lt;h3&gt;
  
  
  13.1 Disable Security Hub CSPM (delegated admin account)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;code&gt;cspm-admin-account&lt;/code&gt;, go to &lt;strong&gt;Security Hub&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Security standards&lt;/strong&gt;, disable each enabled standard (FSBP, CIS).
&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Settings&lt;/strong&gt;, disable Security Hub entirely for that region.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  13.2 Disable Security Hub Org integration (management account)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;management account&lt;/strong&gt;, open &lt;strong&gt;AWS Organizations → Services&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Security Hub&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Disable trusted access&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Optionally also remove &lt;code&gt;cspm-admin-account&lt;/code&gt; as the delegated admin for Security Hub.&lt;/p&gt;




&lt;h3&gt;
  
  
  13.3 Stop AWS Config recording
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;management account&lt;/strong&gt;, open &lt;strong&gt;AWS Config&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Settings&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Stop the &lt;strong&gt;configuration recorder&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you created any extra Config rules just for the lab, delete those as well.&lt;/p&gt;




&lt;h3&gt;
  
  
  13.4 Clean up S3 buckets
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;S3&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Empty and delete:

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Config logs bucket&lt;/strong&gt; (if you created a dedicated one).
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;test misconfig bucket&lt;/strong&gt; (&lt;code&gt;cspm-test-bucket-001&lt;/code&gt;, etc.).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  13.5 Remove test security groups
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;EC2&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete &lt;code&gt;cspm-open-ssh-test&lt;/code&gt; and any other lab-only security groups.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  13.6 Remove IAM test users &amp;amp; access keys
&lt;/h3&gt;

&lt;p&gt;In the &lt;strong&gt;delegated admin account&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete any lab-only IAM users (for example &lt;code&gt;cspm-cli-access&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;Delete any associated access keys.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is important so old credentials don’t linger.&lt;/p&gt;




&lt;h3&gt;
  
  
  13.7 (Optional) Remove delegated admin assignment
&lt;/h3&gt;

&lt;p&gt;If this was purely a one-off lab:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;management account&lt;/strong&gt;, open Security Hub → &lt;strong&gt;Settings → Accounts&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Remove &lt;code&gt;cspm-admin-account&lt;/code&gt; as the delegated administrator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can keep the account for future security experiments, or close it if you want to minimize cost and clutter.&lt;/p&gt;




&lt;p&gt;&lt;a id="final-thoughts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣4️⃣ Final Thoughts
&lt;/h2&gt;

&lt;p&gt;By the end of this lab you’ve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built a &lt;strong&gt;mini CSPM&lt;/strong&gt; using AWS-native tools.
&lt;/li&gt;
&lt;li&gt;Followed a &lt;strong&gt;real enterprise pattern&lt;/strong&gt; with a management account and delegated admin.
&lt;/li&gt;
&lt;li&gt;Enabled &lt;strong&gt;AWS Config&lt;/strong&gt; and &lt;strong&gt;Security Hub CSPM&lt;/strong&gt; at the org level.
&lt;/li&gt;
&lt;li&gt;Created and fixed &lt;strong&gt;intentional misconfigurations&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Exported findings via the &lt;strong&gt;AWS CLI / CloudShell&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Navigated &lt;strong&gt;SCPs, delegated admin errors, and role switching&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Cleaned up resources to keep your bill (and attack surface) low.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From here, great next steps would be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding &lt;strong&gt;auto-remediation&lt;/strong&gt; with Lambda or Systems Manager Automation.
&lt;/li&gt;
&lt;li&gt;Forwarding findings to a SIEM or logging platform.
&lt;/li&gt;
&lt;li&gt;Combining this with &lt;strong&gt;GuardDuty&lt;/strong&gt;, &lt;strong&gt;IAM Access Analyzer&lt;/strong&gt;, and &lt;strong&gt;Config Conformance Packs&lt;/strong&gt;. &lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;If you build on this and share your own twist, tag me; I’d love to see how your CSPM lab evolves. 🚀&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="https://linkedin.com/in/ldwit" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>aws</category>
      <category>cloud</category>
      <category>cspm</category>
    </item>
    <item>
      <title>🔒 Beginner’s Guide to AWS IAM Hardening</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Wed, 17 Dec 2025 01:49:32 +0000</pubDate>
      <link>https://forem.com/ldwit/beginners-guide-to-aws-iam-hardening-5ag2</link>
      <guid>https://forem.com/ldwit/beginners-guide-to-aws-iam-hardening-5ag2</guid>
      <description>&lt;h2&gt;
  
  
  ⭐ Why I Built This Project (Part 1 — IAM Hardening)
&lt;/h2&gt;

&lt;p&gt;Instead of studying cloud security concepts in isolation, I’m using &lt;strong&gt;real job descriptions&lt;/strong&gt; as a roadmap and building hands-on projects that map directly to what employers expect in day-to-day cloud security roles.&lt;/p&gt;

&lt;p&gt;When reviewing cloud security, cloud operations, and security engineering job postings, the same foundational skills appear repeatedly. This &lt;strong&gt;6-part project series&lt;/strong&gt; is designed to build those skills progressively through practical, portfolio-ready labs.&lt;/p&gt;

&lt;p&gt;This series focuses on real-world responsibilities such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity hardening and MFA enforcement
&lt;/li&gt;
&lt;li&gt;IAM governance and access reviews
&lt;/li&gt;
&lt;li&gt;Continuous monitoring of cloud resources
&lt;/li&gt;
&lt;li&gt;Log analysis, audit readiness, and evidence gathering
&lt;/li&gt;
&lt;li&gt;Guardrails at scale using AWS Organizations and Service Control Policies (SCPs)
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each project emphasizes &lt;strong&gt;hands-on implementation&lt;/strong&gt;, not just theory, and mirrors how security controls are applied in real AWS environments.&lt;/p&gt;




&lt;h3&gt;
  
  
  📌 Project Sequence Overview
&lt;/h3&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 1 — AWS IAM Hardening (this project)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Establishes a secure identity foundation by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Securing the root account
&lt;/li&gt;
&lt;li&gt;Enforcing MFA
&lt;/li&gt;
&lt;li&gt;Strengthening password policies
&lt;/li&gt;
&lt;li&gt;Applying least-privilege access
&lt;/li&gt;
&lt;li&gt;Auditing identities using CloudTrail and credential reports
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 &lt;strong&gt;Part 2 — Cloud Security Posture Management (CSPM)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Builds on the identity foundation by introducing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Security Hub and AWS Config
&lt;/li&gt;
&lt;li&gt;Misconfiguration detection
&lt;/li&gt;
&lt;li&gt;Posture evaluation against security standards
&lt;/li&gt;
&lt;li&gt;Enterprise-style governance patterns
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔐 Why This Progression Matters
&lt;/h3&gt;

&lt;p&gt;Modern cloud security programs are layered by design:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identity first → Posture second → Threat detection next.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without a strong IAM foundation, posture management, threat detection, and incident response controls become far less effective. This first project intentionally focuses on IAM hardening to set the stage for everything that follows in the series.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;A hands-on portfolio lab covering IAM hardening basics.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a id="toc"&gt;&lt;/a&gt;Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction
&lt;/li&gt;
&lt;li&gt;
What You’ll Build
&lt;/li&gt;
&lt;li&gt;
Lab Setup
&lt;/li&gt;
&lt;li&gt;
Step 1 — Create an IAM Admin User
&lt;/li&gt;
&lt;li&gt;
Step 2 — Enable MFA for Root &amp;amp; Admin
&lt;/li&gt;
&lt;li&gt;
Step 3 — Strengthen the IAM Password Policy
&lt;/li&gt;
&lt;li&gt;
Step 4 — Create Billing &amp;amp; Finance Groups
&lt;/li&gt;
&lt;li&gt;
Step 5 — Enforce MFA Using Service Control Policies (SCPs)
&lt;/li&gt;
&lt;li&gt;
Step 6 — Validate MFA Enforcement
&lt;/li&gt;
&lt;li&gt;
Step 7 — Configure &amp;amp; Verify CloudTrail
&lt;/li&gt;
&lt;li&gt;
Step 8 — Inspect CloudTrail Logs in S3
&lt;/li&gt;
&lt;li&gt;
Step 9 — Generate the IAM Credential Report
&lt;/li&gt;
&lt;li&gt;
Step 10 — Before/After Hardening Comparison
&lt;/li&gt;
&lt;li&gt;
Optional — Billing Conductor &amp;amp; Real-World Finance Modeling
&lt;/li&gt;
&lt;li&gt;
Troubleshooting Guide
&lt;/li&gt;
&lt;li&gt;
Cleanup to Avoid Charges
&lt;/li&gt;
&lt;li&gt;Credits&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;a id="intro"&gt;&lt;/a&gt;1. Introduction
&lt;/h2&gt;

&lt;p&gt;AWS Identity and Access Management (IAM) is one of the most important skills for any cloud engineer or cloud security analyst.&lt;br&gt;&lt;br&gt;
In this beginner-friendly project, you’ll harden an AWS account using &lt;strong&gt;real cloud security techniques&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multi‑Factor Authentication (MFA)
&lt;/li&gt;
&lt;li&gt;IAM Groups &amp;amp; Roles
&lt;/li&gt;
&lt;li&gt;Strong Password Policies
&lt;/li&gt;
&lt;li&gt;Service Control Policies (SCPs)
&lt;/li&gt;
&lt;li&gt;CloudTrail auditing
&lt;/li&gt;
&lt;li&gt;IAM Credential Reports
&lt;/li&gt;
&lt;li&gt;Billing &amp;amp; Finance Access Controls
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide mixes &lt;strong&gt;friendly explanations and technical depth&lt;/strong&gt;, perfect for beginners building a portfolio.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="what-you-build"&gt;&lt;/a&gt;2. What You’ll Build
&lt;/h2&gt;

&lt;p&gt;By the end of this lab, you will have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A secured AWS root account
&lt;/li&gt;
&lt;li&gt;Admin users protected with MFA
&lt;/li&gt;
&lt;li&gt;Billing + Finance access modeled like a real company
&lt;/li&gt;
&lt;li&gt;An MFA-required SCP that blocks API calls without MFA
&lt;/li&gt;
&lt;li&gt;CloudTrail logging all management events
&lt;/li&gt;
&lt;li&gt;IAM Credential Reports showing weak vs hardened states
&lt;/li&gt;
&lt;li&gt;Before/after screenshots for your portfolio
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;a id="setup"&gt;&lt;/a&gt;3. Lab Setup
&lt;/h2&gt;

&lt;p&gt;All you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Free Tier account
&lt;/li&gt;
&lt;li&gt;A phone with an authenticator app
&lt;/li&gt;
&lt;li&gt;Browser
&lt;/li&gt;
&lt;li&gt;Optional spreadsheet for credential report review
&lt;/li&gt;
&lt;/ul&gt;




&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Group creation is used later, but I thought it would make sense to provide an overview.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧩 Creating IAM Groups (Foundational Step)
&lt;/h2&gt;

&lt;p&gt;Before assigning permissions directly to users, AWS best practice is to use &lt;strong&gt;IAM groups&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Groups make access easier to manage, audit, and scale; especially in real environments.&lt;/p&gt;

&lt;p&gt;In this project, IAM groups represent &lt;strong&gt;real-world roles&lt;/strong&gt;, not individuals.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔐 Admin Group
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Admin&lt;/strong&gt; group is used for trusted administrators who manage AWS resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to create the Admin group:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM → User groups&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Group name: &lt;code&gt;Admin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Attach policy:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AdministratorAccess&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create group&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will assign your admin user (&lt;code&gt;test-admin1&lt;/code&gt;) to this group.&lt;/p&gt;




&lt;h3&gt;
  
  
  👀 View-Only Group
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;ViewOnly&lt;/strong&gt; group represents auditors, security analysts, or stakeholders who need visibility without the ability to make changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to create the ViewOnly group:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;IAM → User groups → &lt;strong&gt;Create group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Group name: &lt;code&gt;ViewOnly&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Attach policy:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ViewOnlyAccess&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create group&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This aligns with real-world read-only access used for audits and reviews.&lt;/p&gt;




&lt;h3&gt;
  
  
  💰 Billing / Finance Group (Standard IAM)
&lt;/h3&gt;

&lt;p&gt;Outside of Billing Conductor, many organizations still create a &lt;strong&gt;basic billing group&lt;/strong&gt; for controlled access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optional standard billing group:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;IAM → User groups → &lt;strong&gt;Create group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Group name: &lt;code&gt;Billing&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Attach policy:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Billing&lt;/code&gt; (AWS managed policy)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create group&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Note:&lt;br&gt;&lt;br&gt;
Some billing features remain &lt;strong&gt;root-only&lt;/strong&gt;. This is expected behavior in AWS.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  🧠 Why Groups Matter
&lt;/h3&gt;

&lt;p&gt;Using groups instead of attaching policies directly to users:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplifies permission management&lt;/li&gt;
&lt;li&gt;Reduces misconfiguration risk&lt;/li&gt;
&lt;li&gt;Improves audit readability&lt;/li&gt;
&lt;li&gt;Mirrors how IAM is managed in enterprise environments&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This group-based design sets the foundation for later steps like &lt;strong&gt;MFA enforcement&lt;/strong&gt;, &lt;strong&gt;SCP guardrails&lt;/strong&gt;, and &lt;strong&gt;credential reporting&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;a id="step1"&gt;&lt;/a&gt;4. Step 1 — Create an IAM Admin User
&lt;/h2&gt;

&lt;p&gt;Never use the root account for daily operations.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM → Users → Create user&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Name your admin user: &lt;code&gt;test-admin1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Provide access to AWS Management Console&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Assign to the &lt;strong&gt;Admin&lt;/strong&gt; group
&lt;/li&gt;
&lt;li&gt;Keep password autogenerated
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;a id="step2"&gt;&lt;/a&gt;5. Step 2 — Enable MFA for Root &amp;amp; Admin
&lt;/h2&gt;

&lt;p&gt;MFA increases login security dramatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Root account MFA:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Login as root
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM → Security Credentials&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;Virtual MFA&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Use any authenticator app
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Admin MFA:
&lt;/h3&gt;

&lt;p&gt;Repeat the same steps under the user’s security credentials.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step3"&gt;&lt;/a&gt;6. Step 3 — Strengthen the IAM Password Policy
&lt;/h2&gt;

&lt;p&gt;Before hardening:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3btpwq0uz42ptcvnsv00.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3btpwq0uz42ptcvnsv00.png" alt=" " width="800" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After hardening:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fssuetgj8fvvdl1lrorst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fssuetgj8fvvdl1lrorst.png" alt=" " width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The improved settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;14–character minimum
&lt;/li&gt;
&lt;li&gt;Require uppercase, lowercase, number, symbol
&lt;/li&gt;
&lt;li&gt;Expire passwords after 45 days
&lt;/li&gt;
&lt;li&gt;Prevent last 6 password reuse
&lt;/li&gt;
&lt;li&gt;Require admin reset &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: You'll find password policy in the IAM dashboard, under Account Settings. &lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;a id="step4"&gt;&lt;/a&gt;7. Step 4 — Create Billing &amp;amp; Finance Groups
&lt;/h2&gt;

&lt;p&gt;If you are a beginner (like me) using a standard user account, in AWS only the root user has access to customize billing. &lt;/p&gt;

&lt;p&gt;To simulate a finance department, you may optionally use &lt;strong&gt;Billing Conductor&lt;/strong&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step-by-Step: Create the Billing Conductor Admin Group
&lt;/h3&gt;

&lt;p&gt;Step 1 — Open IAM&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search IAM in the AWS Console&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 2 — Create a new group&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Click User groups → Create group&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BillingConductorAdmins&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Step 3 — Attach Billing Conductor IAM Managed Policies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Search for and attach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AWSBillingConductorFullAccess&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;This AWS-managed policy includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;billingconductor:*&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Relevant IAM permissions to modify pricing rules, billing groups, pricing plans, etc.&lt;/li&gt;
&lt;li&gt;Full CRUD access for Billing Conductor resources&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This is the correct and realistic choice for FinOps/Billing Engineers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvpr2mp2o7j9yschoxcv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvpr2mp2o7j9yschoxcv.png" alt=" " width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  🧠 Quick Summary Table
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;AWS Billing&lt;/th&gt;
&lt;th&gt;AWS Billing Conductor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard monthly bills&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;td&gt;✔ Yes (customized)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost Explorer&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Budgets&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payment methods&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free-tier usage&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom pricing/markups&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise multi-account invoicing&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✔ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Needed for your project?&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;✔ Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;❌ No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;a id="step5"&gt;&lt;/a&gt;8. Step 5 — Enforce MFA Using a Service Control Policy (SCP)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What SCPs &lt;em&gt;actually&lt;/em&gt; do:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;They &lt;strong&gt;do NOT block login&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;They &lt;strong&gt;DO block all AWS actions until MFA is used&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;They apply at the &lt;strong&gt;Organizations&lt;/strong&gt; level&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Enforcing MFA at Scale with AWS Organizations (Most Common Modern Method)
&lt;/h2&gt;

&lt;p&gt;Step 1 — Create an AWS Organization&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Free&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automatically designates your current account as the management account&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 2 — Go to “Service Control Policies”&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn SCPs ON&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3 — Create SCP: “Require-MFA-For-All-Actions”&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paste the JSON below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 4 — Attach SCP to the Root OU&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This enforces it for ALL accounts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 5 — Test the Behavior&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sign in as a non-MFA user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try to open S3 → Access Denied&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try to use CLI → AccessDeniedException&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Your MFA Enforcement SCP
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DenyAllAPICallsWithoutMFA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Deny"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"BoolIfExists"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"aws:MultiFactorAuthPresent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Sid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AllowMFASelfManagement"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:ListUsers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:GetUser"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:ListMFADevices"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:CreateVirtualMFADevice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:EnableMFADevice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"iam:ResyncMFADevice"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Attaching the SCP
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You must go to &lt;strong&gt;SCP → Targets → Attach&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Then select &lt;strong&gt;Attach Policy&lt;/strong&gt; → &lt;code&gt;Root&lt;/code&gt; or &lt;em&gt;the account(s) you want to apply the policy&lt;/em&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is essential for activation.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step6"&gt;&lt;/a&gt;9. Step 6 — Validate MFA Enforcement
&lt;/h2&gt;

&lt;p&gt;You tested login without MFA:&lt;/p&gt;

&lt;h3&gt;
  
  
  Expected:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Login succeeds (AWS does not enforce MFA during login)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All actions fail&lt;/strong&gt; once logged in&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0631hiy55f3pfdd78gga.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0631hiy55f3pfdd78gga.png" alt=" " width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is &lt;em&gt;correct behavior&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step7"&gt;&lt;/a&gt;10. Step 7 — Configure &amp;amp; Verify CloudTrail
&lt;/h2&gt;

&lt;p&gt;Enable CloudTrail management events:&lt;/p&gt;

&lt;h5&gt;
  
  
  - 1. Open CloudTrail
&lt;/h5&gt;

&lt;p&gt;AWS Console → search CloudTrail&lt;/p&gt;

&lt;h5&gt;
  
  
  - 2. Go to “Trails”
&lt;/h5&gt;

&lt;p&gt;Left menu → Trails&lt;/p&gt;

&lt;h5&gt;
  
  
  - 3. Click “Create Trail”
&lt;/h5&gt;

&lt;p&gt;Choose a Trail name. Example: &lt;code&gt;iam-hardening-trail&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Apply trail to all regions: ✔ Yes (recommended)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Management events: ✔ Read/Write&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data events: ❌ Off (not needed for this project)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Insight events: ❌ Off (optional)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  - 4. Create (or select) an S3 Bucket
&lt;/h5&gt;

&lt;p&gt;Let AWS auto-create it&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;Use an existing bucket; Example: &lt;code&gt;cloudtrail-iam-hardening-logs-12345&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  - 5. Save
&lt;/h5&gt;

&lt;p&gt;Your trail is now active.&lt;/p&gt;

&lt;p&gt;Settings used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Management Events: ON
&lt;/li&gt;
&lt;li&gt;Read Events: ON
&lt;/li&gt;
&lt;li&gt;Write Events: ON
&lt;/li&gt;
&lt;li&gt;No cost for first copy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6b3vechayl9chaobnn8n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6b3vechayl9chaobnn8n.png" alt=" " width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step8"&gt;&lt;/a&gt;11. Step 8 — Inspect CloudTrail Logs in S3
&lt;/h2&gt;

&lt;p&gt;You correctly observed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logs appear immediately in S3
&lt;/li&gt;
&lt;li&gt;But object URL access is &lt;strong&gt;blocked by design&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Even with CloudTrailReadOnly + SecurityAudit, S3 bucket policy must allow object access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybmaa5c0r3lokgkbeena.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybmaa5c0r3lokgkbeena.png" alt=" " width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="step9"&gt;&lt;/a&gt;12. Step 9 — Generate the IAM Credential Report
&lt;/h2&gt;

&lt;p&gt;Before hardening:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F910gjxr37uncfhyuch8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F910gjxr37uncfhyuch8l.png" alt=" " width="800" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After hardening:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgfkh5x4ho6tvuz9wdlr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgfkh5x4ho6tvuz9wdlr.png" alt=" " width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS Timing Note
&lt;/h3&gt;

&lt;p&gt;Credential Reports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are generated automatically every 4 hours
&lt;/li&gt;
&lt;li&gt;But can be requested manually
&lt;/li&gt;
&lt;li&gt;May not update instantly due to eventual consistency &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The above images represent user additions only. Users have been removed post project. This is a single account enterprise approach.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Users will need to login and activate / setup MFA&lt;/li&gt;
&lt;li&gt;Never expose access keys&lt;/li&gt;
&lt;li&gt;Be careful about exposing account info, immediately remove / disable accounts after testing&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;a id="step10"&gt;&lt;/a&gt;13. Step 10 — Before/After Hardening Comparison
&lt;/h2&gt;

&lt;p&gt;You now have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No unused access keys
&lt;/li&gt;
&lt;li&gt;MFA enabled
&lt;/li&gt;
&lt;li&gt;Strong password policies
&lt;/li&gt;
&lt;li&gt;SCP enforcing MFA
&lt;/li&gt;
&lt;li&gt;Billing access restricted
&lt;/li&gt;
&lt;li&gt;CloudTrail logging everything
&lt;/li&gt;
&lt;li&gt;Credential Report shows secure posture
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Your results may be different. I have existing test / project accounts.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;a id="billing"&gt;&lt;/a&gt;14. Optional — Billing Conductor Overview
&lt;/h2&gt;

&lt;p&gt;Billing Conductor is used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Group accounts for billing
&lt;/li&gt;
&lt;li&gt;Apply discounts/markups
&lt;/li&gt;
&lt;li&gt;Model finance departments
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You tested pricing rule creation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fszucayrwamvo1u04dzfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fszucayrwamvo1u04dzfc.png" alt=" " width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="troubleshooting"&gt;&lt;/a&gt;15. Troubleshooting Guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ❗ CloudTrail logs visible but cannot open object URL
&lt;/h3&gt;

&lt;p&gt;Expected. Bucket policy blocks access.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❗ SCP attached but login not requiring MFA
&lt;/h3&gt;

&lt;p&gt;Correct. SCP works at &lt;strong&gt;API level&lt;/strong&gt;, not login.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❗ Credential report missing new users
&lt;/h3&gt;

&lt;p&gt;Wait 5–20 minutes or re-request.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a id="cleanup"&gt;&lt;/a&gt;16. Cleanup to Avoid Costs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Delete CloudTrail trail
&lt;/li&gt;
&lt;li&gt;Delete S3 log bucket
&lt;/li&gt;
&lt;li&gt;Delete Billing Conductor rules
&lt;/li&gt;
&lt;li&gt;Remove test IAM users
&lt;/li&gt;
&lt;li&gt;Remove SCP
&lt;/li&gt;
&lt;li&gt;Remove MFA from test users
&lt;/li&gt;
&lt;li&gt;Remove IAM groups you created
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;a id="credit"&gt;&lt;/a&gt;17.🤝 Connect
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="//linkedin.com/in/ldwit"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>security</category>
      <category>iam</category>
    </item>
    <item>
      <title>🕵️‍♀️ Nmap &amp; Scapy on Kali: A Beginner-Friendly Packet Adventure</title>
      <dc:creator>LaTerral Williams</dc:creator>
      <pubDate>Thu, 11 Dec 2025 11:01:31 +0000</pubDate>
      <link>https://forem.com/ldwit/nmap-scapy-on-kali-a-beginner-friendly-packet-adventure-4dio</link>
      <guid>https://forem.com/ldwit/nmap-scapy-on-kali-a-beginner-friendly-packet-adventure-4dio</guid>
      <description>&lt;p&gt;This guide walks through the &lt;strong&gt;Nmap&lt;/strong&gt; and &lt;strong&gt;Scapy&lt;/strong&gt; labs I completed as part of a cybersecurity class. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Lab context:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Kali Linux OVA on VirtualBox, using a &lt;em&gt;class lab&lt;/em&gt; network range (e.g. &lt;code&gt;10.6.6.0/24&lt;/code&gt;).&lt;br&gt;&lt;br&gt;
Tools: &lt;strong&gt;Nmap&lt;/strong&gt;, &lt;strong&gt;Scapy&lt;/strong&gt;, &lt;strong&gt;tcpdump&lt;/strong&gt;, &lt;strong&gt;Wireshark&lt;/strong&gt;, and a bit of &lt;strong&gt;SMB&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’ll show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The exact commands I ran
&lt;/li&gt;
&lt;li&gt;What each option means (beginner-friendly)
&lt;/li&gt;
&lt;li&gt;How to capture and inspect traffic
&lt;/li&gt;
&lt;li&gt;How this maps to &lt;em&gt;real-world&lt;/em&gt; security work
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’ll also include a snippet for if you want to consider a &lt;strong&gt;GitHub repo&lt;/strong&gt; later.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🛑 &lt;strong&gt;Ethics &amp;amp; Safety Reminder&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Only scan networks and systems you &lt;strong&gt;own&lt;/strong&gt; or have &lt;strong&gt;explicit permission&lt;/strong&gt; to test.&lt;br&gt;&lt;br&gt;
Everything here is done inside a &lt;strong&gt;controlled class lab&lt;/strong&gt; environment.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="toc"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
Introduction
&lt;/li&gt;
&lt;li&gt;
Lab Setup Overview
&lt;/li&gt;
&lt;li&gt;
Quick Tool Overview
&lt;/li&gt;
&lt;li&gt;
Part 1 – Nmap Lab

&lt;ul&gt;
&lt;li&gt;
4.1 Host Discovery with &lt;code&gt;-sn&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
4.2 OS Detection with &lt;code&gt;-O&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
4.3 Service Detection &amp;amp; Aggressive Scan
&lt;/li&gt;
&lt;li&gt;
4.4 SMB Enumeration (Ports 139 &amp;amp; 445)
&lt;/li&gt;
&lt;li&gt;4.5 Capturing Scan Traffic with &lt;code&gt;tcpdump&lt;/code&gt; + Wireshark&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Part 2 – Scapy Lab

&lt;ul&gt;
&lt;li&gt;
5.1 Starting Scapy the Right Way
&lt;/li&gt;
&lt;li&gt;
5.2 First Sniff: Watching a Ping to Google
&lt;/li&gt;
&lt;li&gt;
5.3 Using Variables (&lt;code&gt;paro&lt;/code&gt;) and &lt;code&gt;.summary()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
5.4 Sniffing Lab Traffic on &lt;code&gt;br-internal&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
5.5 ICMP-Only Sniff with Filters and Counts
&lt;/li&gt;
&lt;li&gt;5.6 Inspecting Individual Packets &amp;amp; Fields&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Troubleshooting &amp;amp; Common Gotchas
&lt;/li&gt;
&lt;li&gt;
How This Maps to Real-World Security Work
&lt;/li&gt;
&lt;li&gt;
How I’ll Structure the GitHub Repo
&lt;/li&gt;
&lt;li&gt;
Final Reflections
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;a id="1-introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;In this lab, I used &lt;strong&gt;Kali Linux&lt;/strong&gt; on &lt;strong&gt;VirtualBox&lt;/strong&gt; to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Discover hosts on a lab subnet
&lt;/li&gt;
&lt;li&gt;Probe a specific target (&lt;code&gt;10.6.6.23&lt;/code&gt;) with &lt;strong&gt;Nmap&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enumerate SMB shares
&lt;/li&gt;
&lt;li&gt;Capture traffic with &lt;code&gt;tcpdump&lt;/code&gt; and open it in &lt;strong&gt;Wireshark&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Scapy&lt;/strong&gt; to &lt;strong&gt;sniff, store, and inspect packets&lt;/strong&gt; (including ICMP and HTTP-like traffic)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re new to Nmap and Scapy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of &lt;strong&gt;Nmap&lt;/strong&gt; as a &lt;strong&gt;network scanner&lt;/strong&gt; (who’s online, what ports, what services).
&lt;/li&gt;
&lt;li&gt;Think of &lt;strong&gt;Scapy&lt;/strong&gt; as &lt;strong&gt;Python-powered packet LEGO&lt;/strong&gt; – you can sniff, dissect, and even craft packets.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="2-lab-setup-overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Lab Setup Overview
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Host&lt;/strong&gt;: Your regular OS (Windows / macOS / Linux)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VM&lt;/strong&gt;: Kali Linux OVA imported into &lt;strong&gt;VirtualBox&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt;: Class lab network (example: &lt;code&gt;10.6.6.0/24&lt;/code&gt;)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target system&lt;/strong&gt;: &lt;code&gt;10.6.6.23&lt;/code&gt; (lab host with SMB services)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;📝 Document your VM networking mode (NAT, Bridged, Internal Network). My lab environment used an internal bridge named &lt;code&gt;br-internal&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: &lt;strong&gt;It is important that your VM has network access for some of the testing to work.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="3-quick-tool-overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Quick Tool Overview
&lt;/h2&gt;

&lt;p&gt;Tools used in this assignment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nmap&lt;/strong&gt; – Port scanning, OS detection, service identification, SMB enumeration
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;smbclient&lt;/strong&gt; – Connect to SMB shares
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;tcpdump&lt;/strong&gt; – Capture packets into &lt;code&gt;.pcap&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wireshark&lt;/strong&gt; – GUI packet analysis
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scapy&lt;/strong&gt; – Python-based packet crafting/sniffing toolkit&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="4-nmap-lab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Part 1 - Nmap Lab
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Commands used:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sn&lt;/span&gt; 10.6.6.0/24
&lt;span class="nb"&gt;sudo &lt;/span&gt;nmap &lt;span class="nt"&gt;-O&lt;/span&gt; 10.6.6.23
nmap &lt;span class="nt"&gt;-p21&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-T4&lt;/span&gt; 10.6.6.23
nmap &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-p139&lt;/span&gt;,445 10.6.6.23
nmap &lt;span class="nt"&gt;--script&lt;/span&gt; smb-enum-shares.nse &lt;span class="nt"&gt;-p445&lt;/span&gt; 10.6.6.23
smbclient //10.6.6.23/print&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;-N&lt;/span&gt;
ifconfig
ip route
&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/resolv.conf
&lt;span class="nb"&gt;sudo &lt;/span&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-s&lt;/span&gt; 0 &lt;span class="nt"&gt;-w&lt;/span&gt; packetcapture.pcap
&lt;span class="nb"&gt;ls &lt;/span&gt;packetcapture.pcap
wireshark
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="4-1-host-discovery-sn"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.1 Host Discovery with &lt;code&gt;-sn&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sn&lt;/span&gt; 10.6.6.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Performs a &lt;em&gt;ping scan&lt;/em&gt; across the &lt;code&gt;/24&lt;/code&gt; network to identify active hosts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You always start by identifying &lt;strong&gt;what is alive&lt;/strong&gt; before deeper scans.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nmap &lt;span class="nt"&gt;-sn&lt;/span&gt; 10.6.6.0/24
Starting Nmap 7.94 &lt;span class="o"&gt;(&lt;/span&gt; https://nmap.org &lt;span class="o"&gt;)&lt;/span&gt; at 2025-12-10 01:36 UTC
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;10.6.6.1
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.00019s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;webgoat.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.11&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.00017s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;juice-shop.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.12&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.00013s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;dvwa.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.13&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000074s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;mutillidae.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.14&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000035s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;gravemind.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.00027s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;10.6.6.100
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000049s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Nmap &lt;span class="k"&gt;done&lt;/span&gt;: 256 IP addresses &lt;span class="o"&gt;(&lt;/span&gt;7 hosts up&lt;span class="o"&gt;)&lt;/span&gt; scanned &lt;span class="k"&gt;in &lt;/span&gt;6.31 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="4-2-os-detection-o"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 OS Detection with &lt;code&gt;-O&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nmap &lt;span class="nt"&gt;-O&lt;/span&gt; 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uses TCP/IP fingerprinting to guess the remote OS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Root is required&lt;/strong&gt; because raw packets are used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nmap &lt;span class="nt"&gt;-O&lt;/span&gt; 10.6.6.23
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; password &lt;span class="k"&gt;for &lt;/span&gt;kali: 
Starting Nmap 7.94 &lt;span class="o"&gt;(&lt;/span&gt; https://nmap.org &lt;span class="o"&gt;)&lt;/span&gt; at 2025-12-10 01:39 UTC
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;gravemind.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000037s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
Not shown: 994 closed tcp ports &lt;span class="o"&gt;(&lt;/span&gt;reset&lt;span class="o"&gt;)&lt;/span&gt;
PORT    STATE SERVICE
21/tcp  open  ftp
22/tcp  open  ssh
53/tcp  open  domain
80/tcp  open  http
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds
MAC Address: 02:42:0A:06:06:17 &lt;span class="o"&gt;(&lt;/span&gt;Unknown&lt;span class="o"&gt;)&lt;/span&gt;
No exact OS matches &lt;span class="k"&gt;for &lt;/span&gt;host &lt;span class="o"&gt;(&lt;/span&gt;If you know what OS is running on it, see https://nmap.org/submit/ &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
TCP/IP fingerprint:
OS:SCAN&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;V&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7.94%E&lt;span class="o"&gt;=&lt;/span&gt;4%D&lt;span class="o"&gt;=&lt;/span&gt;12/10%OT&lt;span class="o"&gt;=&lt;/span&gt;21%CT&lt;span class="o"&gt;=&lt;/span&gt;1%CU&lt;span class="o"&gt;=&lt;/span&gt;38430%PV&lt;span class="o"&gt;=&lt;/span&gt;Y%DS&lt;span class="o"&gt;=&lt;/span&gt;1%DC&lt;span class="o"&gt;=&lt;/span&gt;D%G&lt;span class="o"&gt;=&lt;/span&gt;Y%M&lt;span class="o"&gt;=&lt;/span&gt;02420A%
OS:TM&lt;span class="o"&gt;=&lt;/span&gt;6938CF53%P&lt;span class="o"&gt;=&lt;/span&gt;x86_64-pc-linux-gnu&lt;span class="o"&gt;)&lt;/span&gt;SEQ&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;SP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;FA%GCD&lt;span class="o"&gt;=&lt;/span&gt;1%ISR&lt;span class="o"&gt;=&lt;/span&gt;FF%TI&lt;span class="o"&gt;=&lt;/span&gt;Z%CI&lt;span class="o"&gt;=&lt;/span&gt;Z%II&lt;span class="o"&gt;=&lt;/span&gt;I%
OS:TS&lt;span class="o"&gt;=&lt;/span&gt;A&lt;span class="o"&gt;)&lt;/span&gt;OPS&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;O1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;M5B4ST11NW7%O2&lt;span class="o"&gt;=&lt;/span&gt;M5B4ST11NW7%O3&lt;span class="o"&gt;=&lt;/span&gt;M5B4NNT11NW7%O4&lt;span class="o"&gt;=&lt;/span&gt;M5B4ST11NW7%O5
OS:&lt;span class="o"&gt;=&lt;/span&gt;M5B4ST11NW7%O6&lt;span class="o"&gt;=&lt;/span&gt;M5B4ST11&lt;span class="o"&gt;)&lt;/span&gt;WIN&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;W1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;FE88%W2&lt;span class="o"&gt;=&lt;/span&gt;FE88%W3&lt;span class="o"&gt;=&lt;/span&gt;FE88%W4&lt;span class="o"&gt;=&lt;/span&gt;FE88%W5&lt;span class="o"&gt;=&lt;/span&gt;FE88%W6&lt;span class="o"&gt;=&lt;/span&gt;
OS:FE88&lt;span class="o"&gt;)&lt;/span&gt;ECN&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%W&lt;span class="o"&gt;=&lt;/span&gt;FAF0%O&lt;span class="o"&gt;=&lt;/span&gt;M5B4NNSNW7%CC&lt;span class="o"&gt;=&lt;/span&gt;Y%Q&lt;span class="o"&gt;=)&lt;/span&gt;T1&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%S&lt;span class="o"&gt;=&lt;/span&gt;O%                                                                                     
OS:A&lt;span class="o"&gt;=&lt;/span&gt;S+%F&lt;span class="o"&gt;=&lt;/span&gt;AS%RD&lt;span class="o"&gt;=&lt;/span&gt;0%Q&lt;span class="o"&gt;=)&lt;/span&gt;T2&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;N&lt;span class="o"&gt;)&lt;/span&gt;T3&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;N&lt;span class="o"&gt;)&lt;/span&gt;T4&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%W&lt;span class="o"&gt;=&lt;/span&gt;0%S&lt;span class="o"&gt;=&lt;/span&gt;A%A&lt;span class="o"&gt;=&lt;/span&gt;Z%F&lt;span class="o"&gt;=&lt;/span&gt;R%O&lt;span class="o"&gt;=&lt;/span&gt;%RD&lt;span class="o"&gt;=&lt;/span&gt;0                                                                                     
OS:%Q&lt;span class="o"&gt;=)&lt;/span&gt;T5&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%W&lt;span class="o"&gt;=&lt;/span&gt;0%S&lt;span class="o"&gt;=&lt;/span&gt;Z%A&lt;span class="o"&gt;=&lt;/span&gt;S+%F&lt;span class="o"&gt;=&lt;/span&gt;AR%O&lt;span class="o"&gt;=&lt;/span&gt;%RD&lt;span class="o"&gt;=&lt;/span&gt;0%Q&lt;span class="o"&gt;=)&lt;/span&gt;T6&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%W&lt;span class="o"&gt;=&lt;/span&gt;0%S                                                                                     
OS:&lt;span class="o"&gt;=&lt;/span&gt;A%A&lt;span class="o"&gt;=&lt;/span&gt;Z%F&lt;span class="o"&gt;=&lt;/span&gt;R%O&lt;span class="o"&gt;=&lt;/span&gt;%RD&lt;span class="o"&gt;=&lt;/span&gt;0%Q&lt;span class="o"&gt;=)&lt;/span&gt;T7&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;Y%T&lt;span class="o"&gt;=&lt;/span&gt;40%W&lt;span class="o"&gt;=&lt;/span&gt;0%S&lt;span class="o"&gt;=&lt;/span&gt;Z%A&lt;span class="o"&gt;=&lt;/span&gt;S+%F&lt;span class="o"&gt;=&lt;/span&gt;AR%O&lt;span class="o"&gt;=&lt;/span&gt;%RD&lt;span class="o"&gt;=&lt;/span&gt;0%Q&lt;span class="o"&gt;=)&lt;/span&gt;U1&lt;span class="o"&gt;(&lt;/span&gt;R                                                                                     
OS:&lt;span class="o"&gt;=&lt;/span&gt;Y%DF&lt;span class="o"&gt;=&lt;/span&gt;N%T&lt;span class="o"&gt;=&lt;/span&gt;40%IPL&lt;span class="o"&gt;=&lt;/span&gt;164%UN&lt;span class="o"&gt;=&lt;/span&gt;0%RIPL&lt;span class="o"&gt;=&lt;/span&gt;G%RID&lt;span class="o"&gt;=&lt;/span&gt;G%RIPCK&lt;span class="o"&gt;=&lt;/span&gt;G%RUCK&lt;span class="o"&gt;=&lt;/span&gt;G%RUD&lt;span class="o"&gt;=&lt;/span&gt;G&lt;span class="o"&gt;)&lt;/span&gt;IE&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;R&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Y%DFI&lt;span class="o"&gt;=&lt;/span&gt;N                                                                                     
OS:%T&lt;span class="o"&gt;=&lt;/span&gt;40%CD&lt;span class="o"&gt;=&lt;/span&gt;S&lt;span class="o"&gt;)&lt;/span&gt;                                                                                                                                                  

Network Distance: 1 hop                                                                                                                                         

OS detection performed. Please report any incorrect results at https://nmap.org/submit/ &lt;span class="nb"&gt;.&lt;/span&gt;                                                                       
Nmap &lt;span class="k"&gt;done&lt;/span&gt;: 1 IP address &lt;span class="o"&gt;(&lt;/span&gt;1 host up&lt;span class="o"&gt;)&lt;/span&gt; scanned &lt;span class="k"&gt;in &lt;/span&gt;11.39 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="4-3-service-detection-aggressive"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.3 Service Detection &amp;amp; Aggressive Scan
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-p21&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-T4&lt;/span&gt; 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breakdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-p21&lt;/code&gt; → Scan only port 21 (FTP)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-sV&lt;/code&gt; → Service/version detection
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-A&lt;/code&gt; → Aggressive mode (OS detect, versioning, scripts, traceroute)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-T4&lt;/code&gt; → Faster scans
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nmap &lt;span class="nt"&gt;-p21&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-T4&lt;/span&gt; 10.6.6.23
Starting Nmap 7.94 &lt;span class="o"&gt;(&lt;/span&gt; https://nmap.org &lt;span class="o"&gt;)&lt;/span&gt; at 2025-12-10 01:41 UTC
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;gravemind.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000092s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed &lt;span class="o"&gt;(&lt;/span&gt;FTP code 230&lt;span class="o"&gt;)&lt;/span&gt;
| &lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt;    1 0        0              16 Aug 13  2021 file1.txt
| &lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt;    1 0        0              16 Aug 13  2021 file2.txt
| &lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt;    1 0        0              29 Aug 13  2021 file3.txt
|_-rw-r--r--    1 0        0              26 Aug 13  2021 supersecretfile.txt
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to 10.6.6.1
|      Logged &lt;span class="k"&gt;in &lt;/span&gt;as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session &lt;span class="nb"&gt;timeout &lt;/span&gt;&lt;span class="k"&gt;in &lt;/span&gt;seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 3
|      vsFTPd 3.0.3 - secure, fast, stable
|_End of status
Service Info: OS: Unix

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ &lt;span class="nb"&gt;.&lt;/span&gt;
Nmap &lt;span class="k"&gt;done&lt;/span&gt;: 1 IP address &lt;span class="o"&gt;(&lt;/span&gt;1 host up&lt;span class="o"&gt;)&lt;/span&gt; scanned &lt;span class="k"&gt;in &lt;/span&gt;0.30 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="4-4-smb-enumeration"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.4 SMB Enumeration (Ports 139 &amp;amp; 445)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;SMB enumeration&lt;/strong&gt; is the process of querying a target system or network for information related to the Server Message Block (SMB) protocol.&lt;/p&gt;

&lt;h4&gt;
  
  
  Scan SMB ports:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-p139&lt;/span&gt;,445 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nmap &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;-p139&lt;/span&gt;,445 10.6.6.23
Starting Nmap 7.94 &lt;span class="o"&gt;(&lt;/span&gt; https://nmap.org &lt;span class="o"&gt;)&lt;/span&gt; at 2025-12-10 01:48 UTC
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;gravemind.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.000090s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

PORT    STATE SERVICE     VERSION
139/tcp open  netbios-ssn Samba smbd 3.X - 4.X &lt;span class="o"&gt;(&lt;/span&gt;workgroup: WORKGROUP&lt;span class="o"&gt;)&lt;/span&gt;
445/tcp open  netbios-ssn Samba smbd 4.9.5-Debian &lt;span class="o"&gt;(&lt;/span&gt;workgroup: WORKGROUP&lt;span class="o"&gt;)&lt;/span&gt;
Service Info: Host: GRAVEMIND

Host script results:
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled but not required
| smb-os-discovery: 
|   OS: Windows 6.1 &lt;span class="o"&gt;(&lt;/span&gt;Samba 4.9.5-Debian&lt;span class="o"&gt;)&lt;/span&gt;
|   Computer name: gravemind
|   NetBIOS computer name: GRAVEMIND&lt;span class="se"&gt;\x&lt;/span&gt;00
|   Domain name: &lt;span class="se"&gt;\x&lt;/span&gt;00
|   FQDN: gravemind
|_  System &lt;span class="nb"&gt;time&lt;/span&gt;: 2025-12-10T01:48:34+00:00
| smb2-time: 
|   &lt;span class="nb"&gt;date&lt;/span&gt;: 2025-12-10T01:48:33
|_  start_date: N/A
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled &lt;span class="o"&gt;(&lt;/span&gt;dangerous, but default&lt;span class="o"&gt;)&lt;/span&gt;

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ &lt;span class="nb"&gt;.&lt;/span&gt;
Nmap &lt;span class="k"&gt;done&lt;/span&gt;: 1 IP address &lt;span class="o"&gt;(&lt;/span&gt;1 host up&lt;span class="o"&gt;)&lt;/span&gt; scanned &lt;span class="k"&gt;in &lt;/span&gt;16.18 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Enumerate shares:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;--script&lt;/span&gt; smb-enum-shares.nse &lt;span class="nt"&gt;-p445&lt;/span&gt; 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Command Breakdown&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nmap&lt;/code&gt;: The network scanner tool.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--script smb-enum-shares.nse&lt;/code&gt;: Tells Nmap to use the specific Nmap Scripting Engine (NSE) script designed to enumerate SMB shares.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-p445&lt;/code&gt;: Restricts the scan to TCP port 445, the common port for SMB traffic.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;10.6.6.23&lt;/code&gt;: The IP address of the target machine.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;nmap &lt;span class="nt"&gt;--script&lt;/span&gt; smb-enum-shares.nse &lt;span class="nt"&gt;-p445&lt;/span&gt; 10.6.6.23
Starting Nmap 7.94 &lt;span class="o"&gt;(&lt;/span&gt; https://nmap.org &lt;span class="o"&gt;)&lt;/span&gt; at 2025-12-10 01:50 UTC
Nmap scan report &lt;span class="k"&gt;for &lt;/span&gt;gravemind.vm &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt;
Host is up &lt;span class="o"&gt;(&lt;/span&gt;0.00032s latency&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

PORT    STATE SERVICE
445/tcp open  microsoft-ds

Host script results:
| smb-enum-shares: 
|   account_used: &amp;lt;blank&amp;gt;
|   &lt;span class="se"&gt;\\&lt;/span&gt;10.6.6.23&lt;span class="se"&gt;\I&lt;/span&gt;PC&lt;span class="nv"&gt;$:&lt;/span&gt; 
|     Type: STYPE_IPC_HIDDEN
|     Comment: IPC Service &lt;span class="o"&gt;(&lt;/span&gt;Samba 4.9.5-Debian&lt;span class="o"&gt;)&lt;/span&gt;
|     Users: 1
|     Max Users: &amp;lt;unlimited&amp;gt;
|     Path: C:&lt;span class="se"&gt;\t&lt;/span&gt;mp
|     Anonymous access: READ/WRITE
|   &lt;span class="se"&gt;\\&lt;/span&gt;10.6.6.23&lt;span class="se"&gt;\p&lt;/span&gt;rint&lt;span class="nv"&gt;$:&lt;/span&gt; 
|     Type: STYPE_DISKTREE
|     Comment: Printer Drivers
|     Users: 0
|     Max Users: &amp;lt;unlimited&amp;gt;
|     Path: C:&lt;span class="se"&gt;\v&lt;/span&gt;ar&lt;span class="se"&gt;\l&lt;/span&gt;ib&lt;span class="se"&gt;\s&lt;/span&gt;amba&lt;span class="se"&gt;\p&lt;/span&gt;rinters
|     Anonymous access: READ/WRITE
|   &lt;span class="se"&gt;\\&lt;/span&gt;10.6.6.23&lt;span class="se"&gt;\w&lt;/span&gt;orkfiles: 
|     Type: STYPE_DISKTREE
|     Comment: Confidential Workfiles
|     Users: 0
|     Max Users: &amp;lt;unlimited&amp;gt;
|     Path: C:&lt;span class="se"&gt;\v&lt;/span&gt;ar&lt;span class="se"&gt;\s&lt;/span&gt;pool&lt;span class="se"&gt;\s&lt;/span&gt;amba
|_    Anonymous access: READ/WRITE

Nmap &lt;span class="k"&gt;done&lt;/span&gt;: 1 IP address &lt;span class="o"&gt;(&lt;/span&gt;1 host up&lt;span class="o"&gt;)&lt;/span&gt; scanned &lt;span class="k"&gt;in &lt;/span&gt;7.31 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Connect manually:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;smbclient //10.6.6.23/print&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;-N&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Command Breakdown&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;smbclient&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SMB/CIFS client tool&lt;/td&gt;
&lt;td&gt;Connect to Windows-style shared folders&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;//10.6.6.23&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Server IP&lt;/td&gt;
&lt;td&gt;Where the SMB service is hosted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/print$&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Share name (hidden)&lt;/td&gt;
&lt;td&gt;Printer admin share on the target&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-N&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No password prompt&lt;/td&gt;
&lt;td&gt;Anonymous login attempt&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;smbclient //10.6.6.23/print&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nt"&gt;-N&lt;/span&gt;                                                                                                                             
Anonymous login successful
Try &lt;span class="s2"&gt;"help"&lt;/span&gt; to get a list of possible commands.
smb: &lt;span class="se"&gt;\&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="4-5-pcap-wireshark"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.5 Capture Traffic with &lt;code&gt;tcpdump&lt;/code&gt; + Wireshark
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Check network settings:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ifconfig
ip route
&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/resolv.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;└─$ ifconfig
br-internal: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt;  mtu 1500
        inet 10.6.6.1  netmask 255.255.255.0  broadcast 10.6.6.255
        inet6 fe80::42:b1ff:feae:eb4f  prefixlen 64  scopeid 0x20&amp;lt;link&amp;gt;
        ether 02:42:b1:ae:eb:4f  txqueuelen 0  (Ethernet)
        RX packets 1565  bytes 99196 (96.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2534  bytes 168594 (164.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;ip route                                                                                                                                                    
default via 10.0.2.2 dev eth0 proto dhcp src 10.0.2.15 metric 100 
10.0.2.0/24 dev eth0 proto kernel scope &lt;span class="nb"&gt;link &lt;/span&gt;src 10.0.2.15 metric 100 
10.5.5.0/24 dev br-339414195aeb proto kernel scope &lt;span class="nb"&gt;link &lt;/span&gt;src 10.5.5.1 
10.6.6.0/24 dev br-internal proto kernel scope &lt;span class="nb"&gt;link &lt;/span&gt;src 10.6.6.1 
172.17.0.0/16 dev docker0 proto kernel scope &lt;span class="nb"&gt;link &lt;/span&gt;src 172.17.0.1 
192.168.0.0/24 dev br-355ee7945a88 proto kernel scope &lt;span class="nb"&gt;link &lt;/span&gt;src 192.168.0.1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/resolv.conf                                                                                                                                        
&lt;span class="c"&gt;# Generated by NetworkManager&lt;/span&gt;
nameserver 172.16.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Capture packets:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-s&lt;/span&gt; 0 &lt;span class="nt"&gt;-w&lt;/span&gt; packetcapture.pcap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Command Breakdown&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag / Component&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sudo&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run as root&lt;/td&gt;
&lt;td&gt;Required for packet capture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tcpdump&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Packet capture tool&lt;/td&gt;
&lt;td&gt;Similar to Wireshark CLI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-i eth0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Interface selection&lt;/td&gt;
&lt;td&gt;Capture only from eth0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-s 0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Snapshot length&lt;/td&gt;
&lt;td&gt;Capture full packets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-w packetcapture.pcap&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Write to file&lt;/td&gt;
&lt;td&gt;Save packets for later analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-s&lt;/span&gt; 0 &lt;span class="nt"&gt;-w&lt;/span&gt; packetcapture.pcap
tcpdump: listening on eth0, link-type EN10MB &lt;span class="o"&gt;(&lt;/span&gt;Ethernet&lt;span class="o"&gt;)&lt;/span&gt;, snapshot length 262144 bytes
^C38 packets captured
38 packets received by filter
0 packets dropped by kernel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: &lt;strong&gt;You will need to create traffic in a second terminal.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;ping google.com
PING google.com &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt; 56&lt;span class="o"&gt;(&lt;/span&gt;84&lt;span class="o"&gt;)&lt;/span&gt; bytes of data.
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.1 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.2 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.4 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.4 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.6 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;6 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.9 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.7 ms
64 bytes from yx-in-f138.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.138&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.8 ms
^C
&lt;span class="nt"&gt;---&lt;/span&gt; google.com ping statistics &lt;span class="nt"&gt;---&lt;/span&gt;
8 packets transmitted, 8 received, 0% packet loss, &lt;span class="nb"&gt;time &lt;/span&gt;7011ms
rtt min/avg/max/mdev &lt;span class="o"&gt;=&lt;/span&gt; 21.129/21.518/21.916/0.276 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Ctrl + C&lt;/code&gt; in both terminals to stop capture.&lt;/p&gt;

&lt;h4&gt;
  
  
  Open in Wireshark:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wireshark &amp;lt;yourpcapfilename&amp;gt;.pcap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uxcshp8drm1gtisgch4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uxcshp8drm1gtisgch4.png" alt=" " width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="5-scapy-lab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Part 2 – Scapy Lab
&lt;/h2&gt;

&lt;p&gt;Commands used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su
scapy
sniff&lt;span class="o"&gt;()&lt;/span&gt;
&lt;span class="c"&gt;# new terminal&lt;/span&gt;
ping google.com

paro &lt;span class="o"&gt;=&lt;/span&gt; _
paro.summary&lt;span class="o"&gt;()&lt;/span&gt;

sniff&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;iface&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"br-internal"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
ping 10.6.6.1

paro2 &lt;span class="o"&gt;=&lt;/span&gt; _
paro2.summary&lt;span class="o"&gt;()&lt;/span&gt;

sniff&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;iface&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"br-internal"&lt;/span&gt;, &lt;span class="nv"&gt;filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"icmp"&lt;/span&gt;, &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5&lt;span class="o"&gt;)&lt;/span&gt;
ping 10.6.6.23

paro3 &lt;span class="o"&gt;=&lt;/span&gt; _
paro3.summary&lt;span class="o"&gt;()&lt;/span&gt;
paro3[3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="5-1-starting-scapy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.1 Starting Scapy
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su
scapy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scapy opens an interactive Python shell for packet manipulation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;root㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[/home/kali]
└─# scapy
INFO: Can&lt;span class="s1"&gt;'t import PyX. Won'&lt;/span&gt;t be able to use psdump&lt;span class="o"&gt;()&lt;/span&gt; or pdfdump&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

                     aSPY//YASa       
             apyyyyCY//////////YCa       |
            sY//////YSpcs  scpCY//Pp     | Welcome to Scapy
 ayp ayyyyyyySCP//Pp           syY//C    | Version 2.5.0
 AYAsAYYYYYYYY///Ps              cY//S   |
         pCCCCY//p          cSSps y//Y   | https://github.com/secdev/scapy
         SPPPP///a          pP///AC//Y   |
              A//A            cyP////C   | Have fun!
              p///Ac            sC///a   |
              P////YCpc           A//A   | Craft packets like it is your last
       scccccp///pSP///p          p//Y   | day on earth.
      sY/////////y  caa           S//P   |                      &lt;span class="nt"&gt;--&lt;/span&gt; Lao-Tze
       cayCyayP//Ya              pY/Ya   |
        sY/PsY////YCc          aC//Yp 
         sc  sccaCY//PCypaapyCP//YSs  
                  spCPY//////YPSps    
                       ccaacs         
                                       using IPython 8.14.0
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="5-2-sniff-ping-google"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.2 First Sniff: Watching a Ping to Google
&lt;/h3&gt;

&lt;p&gt;Inside Scapy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;sniff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; sniff&lt;span class="o"&gt;()&lt;/span&gt;
^C&amp;lt;Sniffed: TCP:0 UDP:16 ICMP:12 Other:2&amp;gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;New terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;ping google.com
PING google.com &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt; 56&lt;span class="o"&gt;(&lt;/span&gt;84&lt;span class="o"&gt;)&lt;/span&gt; bytes of data.
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;22.0 ms
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.9 ms
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;22.0 ms
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.9 ms
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;21.6 ms
64 bytes from yx-in-f101.1e100.net &lt;span class="o"&gt;(&lt;/span&gt;64.233.177.101&lt;span class="o"&gt;)&lt;/span&gt;: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;6 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;255 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;22.0 ms
^C
&lt;span class="nt"&gt;---&lt;/span&gt; google.com ping statistics &lt;span class="nt"&gt;---&lt;/span&gt;
6 packets transmitted, 6 received, 0% packet loss, &lt;span class="nb"&gt;time &lt;/span&gt;5008ms
rtt min/avg/max/mdev &lt;span class="o"&gt;=&lt;/span&gt; 21.641/21.896/22.043/0.127 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Stop both with &lt;code&gt;Ctrl + C&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="5-3-paro-summary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.3 Using Variables and &lt;code&gt;.summary()&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;paro&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
&lt;span class="n"&gt;paro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;_&lt;/code&gt; holds the last Scapy result. This prints a one‑line summary of all packets.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;paro&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;_
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; paro.summary&lt;span class="o"&gt;()&lt;/span&gt;
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'google.com.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'google.com.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"2607:f8b0:4002:c08::71"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"64.233.177.101"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / IP / ICMP 10.0.2.15 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 64.233.177.101 echo-request 0 / Raw
Ether / IP / ICMP 64.233.177.101 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.0.2.15 echo-reply 0 / Raw
Ether / IP / UDP / DNS Qry &lt;span class="s2"&gt;"b'101.177.233.64.in-addr.arpa.'"&lt;/span&gt; 
Ether / IP / UDP / DNS Ans &lt;span class="s2"&gt;"b'yx-in-f101.1e100.net.'"&lt;/span&gt; 
Ether / ARP &lt;span class="nb"&gt;who &lt;/span&gt;has 10.0.2.2 says 10.0.2.15
Ether / ARP is at 52:55:0a:00:02:02 says 10.0.2.2 / Padding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="5-4-sniff-br-internal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.4 Sniffing on &lt;code&gt;br-internal&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;sniff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iface&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;br-internal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate traffic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping 10.6.6.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;paro2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
&lt;span class="n"&gt;paro2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Here you may have noticed no traffic was captured. &lt;em&gt;This is my assumption&lt;/em&gt;: This is a lab envionment to mimic real-world environments.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In many lab or corporate networks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;.1&lt;/code&gt; is the default gateway&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It may be configured to drop or ignore ping (ICMP) for security.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="5-5-icmp-filter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.5 ICMP-Only Sniff with Filter + Count
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;sniff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iface&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;br-internal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;icmp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate ICMP traffic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Due to count set only the first 5 packets were captured.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;┌──&lt;span class="o"&gt;(&lt;/span&gt;kali㉿Kali&lt;span class="o"&gt;)&lt;/span&gt;-[~]
└─&lt;span class="nv"&gt;$ &lt;/span&gt;ping 10.6.6.23
PING 10.6.6.23 &lt;span class="o"&gt;(&lt;/span&gt;10.6.6.23&lt;span class="o"&gt;)&lt;/span&gt; 56&lt;span class="o"&gt;(&lt;/span&gt;84&lt;span class="o"&gt;)&lt;/span&gt; bytes of data.
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.041 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.035 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.034 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.029 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.030 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;6 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.018 ms
64 bytes from 10.6.6.23: &lt;span class="nv"&gt;icmp_seq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7 &lt;span class="nv"&gt;ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64 &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.028 ms
^C
&lt;span class="nt"&gt;---&lt;/span&gt; 10.6.6.23 ping statistics &lt;span class="nt"&gt;---&lt;/span&gt;
7 packets transmitted, 7 received, 0% packet loss, &lt;span class="nb"&gt;time &lt;/span&gt;6144ms
rtt min/avg/max/mdev &lt;span class="o"&gt;=&lt;/span&gt; 0.018/0.030/0.041/0.006 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="5-6-packet-fields"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5.6 Inspecting Packet Fields
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;paro3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
&lt;span class="n"&gt;paro3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;paro3&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;Sniffed: TCP:0 UDP:0 ICMP:5 Other:0&amp;gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;paro3&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;_
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; paro3.summary&lt;span class="o"&gt;()&lt;/span&gt;
Ether / IP / ICMP 10.6.6.1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.6.6.23 echo-request 0 / Raw
Ether / IP / ICMP 10.6.6.23 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.6.6.1 echo-reply 0 / Raw
Ether / IP / ICMP 10.6.6.1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.6.6.23 echo-request 0 / Raw
Ether / IP / ICMP 10.6.6.23 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.6.6.1 echo-reply 0 / Raw
Ether / IP / ICMP 10.6.6.1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 10.6.6.23 echo-request 0 / Raw
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full details:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;paro3&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Shows details for the third entry in the summary list.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; paro3[3].show&lt;span class="o"&gt;()&lt;/span&gt;
&lt;span class="c"&gt;###[ Ethernet ]### &lt;/span&gt;
  dst       &lt;span class="o"&gt;=&lt;/span&gt; 02:42:b1:ae:eb:4f
  src       &lt;span class="o"&gt;=&lt;/span&gt; 02:42:0a:06:06:17
  &lt;span class="nb"&gt;type&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; IPv4
&lt;span class="c"&gt;###[ IP ]### &lt;/span&gt;
     version   &lt;span class="o"&gt;=&lt;/span&gt; 4
     ihl       &lt;span class="o"&gt;=&lt;/span&gt; 5
     tos       &lt;span class="o"&gt;=&lt;/span&gt; 0x0
     len       &lt;span class="o"&gt;=&lt;/span&gt; 84
     &lt;span class="nb"&gt;id&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; 2449
     flags     &lt;span class="o"&gt;=&lt;/span&gt; 
     frag      &lt;span class="o"&gt;=&lt;/span&gt; 0
     ttl       &lt;span class="o"&gt;=&lt;/span&gt; 64
     proto     &lt;span class="o"&gt;=&lt;/span&gt; icmp
     chksum    &lt;span class="o"&gt;=&lt;/span&gt; 0x50f5
     src       &lt;span class="o"&gt;=&lt;/span&gt; 10.6.6.23
     dst       &lt;span class="o"&gt;=&lt;/span&gt; 10.6.6.1
     &lt;span class="se"&gt;\o&lt;/span&gt;ptions   &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="c"&gt;###[ ICMP ]### &lt;/span&gt;
        &lt;span class="nb"&gt;type&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; echo-reply
        code      &lt;span class="o"&gt;=&lt;/span&gt; 0
        chksum    &lt;span class="o"&gt;=&lt;/span&gt; 0x56f3
        &lt;span class="nb"&gt;id&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; 0xb2ed
        &lt;span class="nb"&gt;seq&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; 0x2
        unused    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
&lt;span class="c"&gt;###[ Raw ]### &lt;/span&gt;
           load      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'n\\xde8i\x00\x00\x00\x00\\x87\x02\t\x00\x00\x00\x00\x00\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&amp;amp;\'&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;+,-./01234567&lt;span class="s1"&gt;'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="6-troubleshooting"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Troubleshooting
&lt;/h2&gt;

&lt;p&gt;Common issues:&lt;/p&gt;

&lt;h3&gt;
  
  
  No packets captured
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Verify interface: &lt;code&gt;ifconfig&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use correct &lt;code&gt;iface&lt;/code&gt; in Scapy&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Nmap OS detection fails
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Firewalls may block probes
&lt;/li&gt;
&lt;li&gt;OS detection is best-effort&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  tcpdump permission denied
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;sudo&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wireshark shows nothing useful
&lt;/h3&gt;

&lt;p&gt;Apply filters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;icmp
smb
ip.addr == 10.6.6.23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="7-real-world"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Real-World Applications
&lt;/h2&gt;

&lt;p&gt;These labs build skills used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Asset discovery&lt;/strong&gt; &amp;amp; &lt;strong&gt;attack surface mapping&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vulnerability assessments&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incident response&lt;/strong&gt; (packet capture)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forensics&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom IDS/IPS development&lt;/strong&gt; (Scapy)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="8-github-structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. GitHub Repo Structure - Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap-scapy-lab/
├── README.md
├── nmap/
│   ├── nmap-host-discovery.md
│   ├── nmap-smb-enum.md
│   └── images/
│       ├── 01-nmap-host-discovery.png
│       └── 02-smb-enum.png
└── scapy/
    ├── scapy-sniffing.md
    ├── scapy-icmp-analysis.md
    └── images/
        ├── 01-scapy-summary.png
        └── 02-scapy-show.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="9-reflections"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Final Reflections
&lt;/h2&gt;

&lt;p&gt;This lab helped me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand Nmap flags and scan behavior
&lt;/li&gt;
&lt;li&gt;Capture and analyze real traffic with tcpdump/Wireshark
&lt;/li&gt;
&lt;li&gt;Use Scapy to dissect packet fields in detail
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Happy scanning responsibly! 🕵️‍♂️📡&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🤝 Connect
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;💬 Feel free to reach out or follow my journey on 👉 &lt;a href="//linkedin.com/in/ldwit"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>cloud</category>
      <category>security</category>
      <category>parocyber</category>
    </item>
  </channel>
</rss>
