
đ Project 2: monitoring/ AWS Root Account Activity with CloudTrail + SNS â Guided by a Security Engineer
This blog is all about - Setting Up Real-Time Alerts Like a Cloud Security Engineer
đ Introduction â The Root of All Risks
Let me tell you a quick story.
When I first created my AWS account, the most powerful key I held was the root account - the âsuper adminâ of everything in the cloud.
But guess what? Using it is a bad idea. Like really bad.
Think of the root account like a master key to a bank vault.
If itâs used casually, or worse - compromised - your entire cloud setup is at risk.
In this project, I wanted to learn how to monitor AWS root account activity in real time - and set up alerts so that if anyone (even me) logs in with it, Iâll know immediately.
Letâs dive in!
đŻ Objective
Simulate a real-world risky action:
âĄď¸ Log in as the root user,
âĄď¸ Perform a sensitive action (like disabling MFA), and
âĄď¸ Detect that activity using:
-
CloudTrail for logging
-
SNS for alerts
-
CloudWatch (EventBridge) for triggering the detection
So -> Detect and respond to sensitive activity performed by using the AWS Root Account, which should be tightly controlled and rarely used.
â ď¸ Why is Root Account Usage a Security Red Flag?
By default, AWS allows you to create and manage your account with a root user, but hereâs what makes it dangerous:
| đ¨ Risk | Why Itâs a Problem |
|---|---|
| â Full permissions | Can delete everything in AWS - no restrictions |
| â MFA disabled | Easy target for attackers |
| 𤍠Hard to track | Used rarely, so any activity is suspicious |
| đĽ No boundaries | Can override all IAM permissions |
So as a security engineer (even a beginner one), we never want to use root unless absolutely necessary.
But if someone does use it? Thatâs an event worth knowing immediately.
đ§° Services Used
Hereâs what weâll use to make our alert system:
| AWS Service | Purpose |
|---|---|
| CloudTrail | Logs every action taken in AWS |
| CloudWatch / EventBridge | Detects specific patterns (like root login) |
| SNS | Sends an alert via Email/SMS |
| IAM | Identity system (helps us know who did what) |
đ ď¸ Step-by-Step Setup: Root Account monitoring/ in AWS
Donât worry, each step includes what and why weâre doing it. â¤ď¸
â Step 1: Simulate the Problem â Log in as Root
Why this step?
We want to see how CloudTrail captures this risky action.
-
Go to AWS Console
-
Log in using the root account email
-
Navigate to Billing Dashboard or Account Settings
-
Try to disable MFA (if enabled)
đ§ This simulates a âsensitive operationâ - exactly what an attacker might try.



đ Step 2: Enable CloudTrail (if not already)
What is CloudTrail?
Itâs AWSâs built-in logging system.
Every time someone does something (login, create S3 bucket, delete EC2 instance, etc.), CloudTrail writes it down.
â Open CloudTrail Service
-
Go to the AWS Console, search for âCloudTrailâ in the search bar, and click the result.
-
Click âCreate trailâ.
đ Configure the Trail:
-
Trail name: I named it RootActivityTrail to clearly reflect its purpose.
-
You may not see options to choose Management/Event types or enable for all regions, because CloudTrail does this automatically now during the setups.
-
â CloudTrail enabled Multi-region trail by default - so activity in all AWS regions will be captured.
-
â CloudTrail also created a dedicated S3 bucket to store logs (youâll see its name under the âS3 bucketâ column later).
-
đĄ Important Note:
When I tried this, I didnât even need to create the S3 bucket manually. AWS CloudTrail smartly created a bucket named something like:
aws-cloudtrail-logs-677604542474-fdc96c6b
This automatic bucket creation makes life easier - especially for beginners!
â Done. Now, every action - including root login - will be logged.





So this step was about turning on the security cameras (CloudTrail) and pointing them at the most sensitive area (root account actions).
If anyone uses the root account - whether itâs you or someone malicious - weâll catch it immediately in our logs.
đ Step 3: Set Up SNS â Our Alerting System
Why SNS?
SNS (Simple Notification Service) can send alerts to email or SMS.
-
Go to SNS â Topics â Create Topic
- Name: RootLoginAlerts
- In the âCreate topicâ screen:
-
â Type: Choose Standard (default)
-
Best-effort ordering
-
At-least once message delivery
-
Supports multiple protocols like Email, Lambda, SQS
-
-
đ§ Why not FIFO?
FIFO topics are mainly for ordering and deduplication in SQS - unnecessary for notifications. Standard gives us flexibility for email alerts. - Right now, your SNS topic doesnât know where to send the alert. We need to subscribe your email address so you get notified instantly when the root account logs in.
-
Click on the topic â Create subscription
-
Protocol: Email
-
Endpoint: Your personal email
-
- Check your inbox and confirm the subscription
đ§ Now youâre ready to receive alerts.










Though i used temp email but you need to use proper active email as you will get a confirmation link you must click before alerts start coming.
đ Why This Step Is Critical for Security
Just logging a root user login event isnât enough. You need to be notified immediately, in case it wasnât you.
Real-world misconfig:
Many engineers set up CloudTrail and even an SNS Topic, but forget to subscribe an endpoint. So when root login happens, they never find out.
Weâre not making that mistake. đ Youâll get alerted within seconds of a root login.
đĄ Step 4: Create CloudWatch Rule (EventBridge)
We now tell AWS:
âIf anyone logs in using the root user, send me an alert.â
First, Letâs know about CloudWatch and EventBridge
đ¤ CloudWatch vs EventBridge â Whatâs the Deal?
If youâre confused about where to create the alert rule â whether in CloudWatch or EventBridge - youâre not alone.
Hereâs the truth in simple terms:
EventBridge is the upgraded version of CloudWatch Events.
Youâll still hear a lot of tutorials and documentation saying:
âCreate a CloudWatch Event RuleâŚâ
But when you go to AWS Console, thereâs no âEventsâ section inside CloudWatch anymore. Instead, AWS has moved that feature into a service called Amazon EventBridge.
â So what does this mean for you?
-
Yes, youâre technically still creating a CloudWatch Event Rule
-
But, you now create it inside EventBridge, not CloudWatch
-
Behind the scenes, itâs using the same API - just a new UI and new name
-
Bonus: EventBridge has cool new features (like Schema Registry, Pipes, Partner Events)
Hereâs how AWS explains it:
EventBridge was formerly called CloudWatch Events. EventBridge uses the same CloudWatch Events API, so your existing setup still works - just with more features.
đ§ Why This Matters for Security Engineers
If youâre monitoring/ root account usage (like we are in this project), youâll often find old blogs telling you to:
âCreate a CloudWatch Event Rule for root login.â
But when you go to CloudWatch in the AWS Console⌠no such thing exists anymore.
đ Thatâs because itâs all inside EventBridge now!
So donât get stuck - just remember:
đĄ When someone says âCloudWatch Rule,âthey mean an âEventBridge Ruleâ now.
See this ->

Why AWS Shows Both CloudWatch and EventBridge?
-
CloudWatch still handles metrics, dashboards, alarms, logs.
-
EventBridge now handles event rules and routing, which used to be called CloudWatch Events.
So both services exist for different monitoring/ and response purposes.
So ->
| Feature | Use This Service |
|---|---|
| Metrics, logs, alarms | CloudWatch |
| Event rules/triggers | EventBridge (new name for CloudWatch Events) |
Think of EventBridge as the âpostal systemâ of AWS.
It listens for âeventsâ (like someone uploading a file to S3 or starting an EC2 instance), and then automatically sends those events to specific targets (like Lambda, SNS, SQS, Step Functions) based on rules you define.
Itâs fully serverless, scalable, and great for event-driven automation.

So there is many components right now like EventBridge Rule, EventBridge Pipes etc Letâs first know about this and which one we need for this time
- EventBridge Rule
- âWhen this happens, do thatâ
- Example: When someone modifies an S3 bucket policy (event), send alert to SNS (target).
- You define a rule that listens for a pattern in events and sends matching events to the target service.
- EventBridge Pipes (NEW Feature)
- Directly connect an event source to a target - like a pipe.
- Useful for streaming-style processing.
- You can even filter and enrich the event in between using Pipes.
- Example: Send filtered DynamoDB stream events to Lambda.
- EventBridge Schedule
- Like a cron job.
- Trigger a target (e.g., Lambda, Step Function) at fixed intervals - daily, weekly, every minute, etc.
- Example: Check IAM role age every 24 hours and rotate if needed.
- EventBridge Schema Registry
- A place to collect and organize all your event structures.
- It auto-discovers the shape (JSON structure) of incoming events.
- Great for developers building apps that consume AWS events.
𤯠Why Is EventBridge Important for Security Engineers?
-
Automated Detection
-
Detect changes like EC2 starting, IAM policy changes, S3 public access attempts.
-
Automatically trigger Lambda or notify via SNS/Slack/Email.
-
-
Real-Time Response
- EventBridge + Lambda can auto-revert misconfigurations (e.g., make an S3 bucket private again if someone makes it public).
-
Audit & monitoring/
-
Forward events to S3 or CloudWatch Logs for security auditing.
-
Build alerts on suspicious activity.
-
-
Decoupled Architecture
- Improves your security system design by decoupling detection and response logic.
Letâs come to our Project now ->
- Select EventBridge Rule and click on Create Rule
We will see this ->

- Letâs choose Name -> DetectRootLogin
- Rule Type -> Rule with an event pattern

We Selected Rule with an Event Pattern - Bt Why ?
Trigger this rule only when a specific event happens So This is for event-driven automation When that exact pattern happens, AWS triggers the rule. This is what you want for security monitoring/ - listen for specific activities like root account usage.
But What about Rule with a Schedule ?
Trigger this rule every X minutes/hours/days no matter what You define a fixed cron schedule (like ârun every 1 hourâ). Useful for periodic checks or batch jobs This is not what we need right now because weâre not doing something on a time schedule - weâre reacting to a real-time event.
We will now see following screen ->

- Keep Selected AWS events or EventBridge partner events
- Event Pattern â Creation method
- Keep selected: Use pattern form (default and easier)
- Even Source -> AWS Services
- AWS Service ->
- Select:
CloudTrail - Because all console login events â including root user logins â are logged by CloudTrail
- Select:
- Event type ->
- Select: AWS API Call via CloudTrail
So Far we will see this ->

So We get this ->
{
"source": ["aws.cloudtrail"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["cloudtrail.amazonaws.com"]
}
}
Before knowing about this , letâs first know what exactly is this
What is an Event Pattern in EventBridge?
Imagine you are the security guard at a giant office building (your AWS account). Youâre watching hundreds of employees (AWS services and users) coming in and doing all kinds of activities - uploading files, running servers, logging in, deleting data.
But you donât care about everything. You only want to be notified when something specific happens - like âsomeone enters using the CEOâs master keyâ (Root account login).
Thatâs where EventBridge event patterns come in.
An Event Pattern is like a filter rule.
It tells AWS:
âHey, I only care about this kind of event. Ignore everything else.â
AWS services constantly emit events - structured JSON messages - about whatâs happening in your account. EventBridge listens to these events and matches them against your pattern.
Only when the pattern matches, your rule is triggered - and the target (email, Lambda, SNS) is notified.
So, we saw Pattern above , letâs know about that pattern ->
What it does:
-
Catches every API call logged by CloudTrail.
-
Very broad - will flood you with too many notifications.
-
Not suitable for alerting on specific logins like root.
So, instead of this Pattern we need following Corrected Pattern ->
{
"source": ["aws.signin"],
"detail-type": ["AWS Console Sign In via CloudTrail"],
"detail": {
"eventName": ["ConsoleLogin"]
}
}
- Just Click on Edit and save above Corrected Pattern there

What it does:
-
Triggers only on AWS Console sign-in attempts.
-
ConsoleLogin is the specific event name for sign-ins.
-
This event includes fields like:
-
userIdentity.type: e.g.,Root,IAMUser,AssumedRole -
responseElements.ConsoleLogin:SuccessorFailure
-
-
You can further filter by root user later (weâll see this in SNS or Lambda filters or in CloudWatch alarms).
đ§Ş How does this help us?
-
Noise reduction: You only get alerted for actual sign-ins, not every API call.
-
Security focus: You care about who logs into your account, especially root.
-
Flexible filtering: You can later narrow this pattern to:
"userIdentity.type": ["Root"] -
Real-time alerts: As soon as this login happens, EventBridge triggers an action - like sending an email or a Slack message.
Next we will see following screen ->

Before going further, letâs know about this steps as well ->
A Target is what should happen when the rule is triggered.
We already defined the âwhenâ using our event pattern (e.g., someone logs in using the Root account).
Now you must tell AWS:
đ âOkay, this just happened â now do this!â
We see 3 Options above as you see -> Letâs know about this as well ->
| Target Type | What It Does |
|---|---|
| EventBridge Event Bus | Sends the event to another EventBridge bus (advanced use case) |
| EventBridge API destination | Sends the event to a 3rd-party SaaS system via HTTPS |
| AWS service â | Triggers an action in any AWS service (like SNS, Lambda, SQS, Step Functions, etc.) |
In Out Case -> want to be notified when root login happens, so weâll choose:
â AWS Service â SNS (Simple Notification Service)
So Select a Target for SNS ->

Why Choose SNS?
-
SNS lets you send emails, SMS, or even forward to other AWS services.
-
You can subscribe your email address to a topic.
-
So as soon as the event happens, you get a real-time alert like:
đ§ Subject: Root Login Detected in AWS
âA ConsoleLogin event was detected for the Root user. This is a serious security concernâŚâ
Now we will see more options ->

Letâs know about this as well ->
| Option | When to Use | Your Case |
|---|---|---|
| Target in this account | If your SNS topic is in the same AWS account | â YES â this is the default and correct choice for now |
| Target in another AWS account | If the SNS topic lives in another AWS account | â No â not needed unless youâre doing cross-account alerts |
Next I choosed following Topic -> as we already created this SNS topic

đ˘ This means: âWhenever root login happens, send that alert to this topic.â
Next is Permission ->
This section tells EventBridge how it is allowed to call SNS on your behalf.
You will see these:
Option 1: â Use execution role (recommended)
This is what we want! It allows EventBridge to assume a role and publish to SNS.
Next we see -> Execution role
| Option | What It Does | Recommendation |
|---|---|---|
| Create a new role for this specific resource | EventBridge will auto-create a minimal IAM role just for this rule | â Best for beginners and small projects |
| Use existing role | If you have a custom IAM role with SNS publish permissions | â Skip unless youâre customizing permissions deeply |
So far ->
| Setting | What to Select |
|---|---|
| Target location | Target in this account |
| Topic | Select your SNS topic (e.g., RootLoginAlertTopic) |
| Permissions | Use execution role (recommended) |
| Execution Role | Create a new role for this specific resource |
â This way, AWS will create the correct IAM role behind the scenes, attach necessary permissions, and you wonât need to worry about IAM policy writing manually.
Next Step -> Tags -> Optional Next Step -> Review and create -> Create Rule
Done
We will see this ->

â Hereâs What Just Happened (Step-by-Step Summary):
| â Step | What You Did |
|---|---|
| đď¸ Identified Event | You filtered for Root login via cloudtrail.amazonaws.com |
| âď¸ Created Rule | You used EventBridge Event Pattern to match login events |
| đŁ Chose SNS Target | You picked your RootLoginAlerts SNS topic to send notifications |
| đ Set Permissions | EventBridge was granted permission to publish to SNS |
| đŻ Final Result | â
DetectRootLogin rule now watches for Root logins and triggers alerts |
Step 5: Test the Setup
Now go back and login again as Root (without MFA).
đĽ You should receive an email like:
ALERT: AWS Root Login Detected Without MFA
Take immediate action.
ALSO ->
Open CloudTrail > Event History, filter for ConsoleLogin events, and then confirm for userIdentity.type is  âRootâ or not
âď¸ What I Did & What I Learned
â What I Did
-
Created a CloudTrail trail to monitor all activity.
-
Configured SNS to alert me for risky root actions.
-
Set up EventBridge rule to detect root login.
-
Tested by logging in as root and received instant email alert.
𤯠What I Learned
-
AWS doesnât block root usage, but it expects you to monitor it.
-
CloudTrail + SNS + EventBridge is a powerful combo to detect threats in real-time.
-
Automating this alert is a basic but critical security hygiene step.
-
Even as a beginner, I felt like I was doing something real - like what pros do in production setups.
đ Final Reflection (For Beginners)
If youâre new to AWS security, let this sink in:
âSecurity isnât always about locking everything down.
Itâs about being aware, setting detection mechanisms, and responding quickly.â
Youâve just done your first real-world threat detection setup. Be proud!
And never, ever use the root account casually again. â ď¸
đ§ž Next Steps (Optional Ideas)
-
Set up alerts for when someone deletes CloudTrail (yes, it happens).
-
Store logs in a versioned S3 bucket to prevent tampering.
-
Use AWS Config to monitor whether MFA is enabled on root at all times.
đ Security Engineer Insight â âThe Root Account Is the Crown Jewel. Guard It Like a Secret Weapon.â
As a security engineer, Iâve seen this - companies lock down everything except the one identity that can destroy it all: the root user.
Letâs be honest :
Most beginners donât realize that the root account is not meant for daily use.
One misstep here isnât a misconfiguration - itâs a full-blown breach waiting to happen.
In this project, I wanted to simulate what actually goes wrong when a root login is not being monitored - and then show you exactly how to fix it.
This wasnât about fancy tools. It was about building the one alarm that matters most - the one that tells you:
Someone just entered the kingdom.
We leveraged CloudTrail, SNS, and EventBridge Rules to set up a low-cost, high-value root monitoring/ pipeline.
â What We Built
By the end of this project, we had a fully working detection & alerting mechanism for AWS root account usage.
Hereâs a breakdown:
| Component | Description |
|---|---|
| đĄď¸ CloudTrail Trail | Custom trail (RootActivityTrail) created with multi-region + global services logging |
| đŻ Event Selector | Filtered to capture only ConsoleLogin events for Root user ARN |
| đ EventBridge Rule | Custom pattern matching on root login events triggering SNS |
| đŹ SNS Notification | Root login alerts sent to email via SNS topic - tested and confirmed working |
| â ď¸ Manual Simulation | Root login simulated and CloudTrail logs + SNS alerts verified |
In short: root login now triggers an email within ~5 minutes.
This is real detection engineering on cloud - not theory, not guesswork.
đ§ What I Learned from This Project (If I Were a Beginner)
If I were a beginner learning this for the first time, hereâs what I wouldâve taken away:
-
CloudTrail Alone Isnât Enough â You Need EventBridge for Real-Time Detection
Most assume CloudTrail is âsecurity.â But unless paired with EventBridge rules and SNS, itâs just logging, not alerting. -
The Root ARN is Special â Treat It Differently in Event Patterns
Matching the exact string"arn:aws:iam::123456789012:root"is critical. Even a minor mismatch leads to no alerts. -
S3 Logging Delay is Real
Just because you donât see the logs instantly doesnât mean itâs broken. AWS may take a few mins to deliver events to S3. -
SNS is Simple But Powerful
Using email as the alert channel is great for MVPs. Later, you can integrate Slack, PagerDuty, or even Lambda functions for automated response. -
Security Isnât About Blocking Only â Itâs About Knowing What Just Happened
Prevention is good, but detection is your parachute when something bypasses your controls.
Root account access in AWS is like having the master key to your entire digital kingdom.
While IAM policies, S3 buckets, and EC2 permissions often grab all the attention, real breaches often begin where no oneâs watching â the root user.
This project wasnât just a technical lab - it was a wake-up call.
If youâre learning cloud security, start with visibility, especially for the identities that can destroy everything in seconds.
Monitor the root account. Alert on it. Treat it like a break-glass-only identity.
Because when it gets used, you shouldnât be finding out days later
You should know before the attacker logs out.
Stay tuned for more Projects