Configure a log metric filter and alarm for root account usage
Why this matters
The root account in AWS holds the highest level of privileges. Any usage of this account should be rare, deliberate, and well-documented. Unexpected or frequent root activity is often a sign of misconfiguration or compromise.
Setting up real-time monitoring allows your security team to detect when the root account is used and to take immediate action if needed. CloudWatch alarms tied to CloudTrail logs provide the necessary visibility and speed of response.
What this check does
This check verifies that:
A CloudWatch metric filter is configured to monitor for root account usage
An alarm is connected to this filter and is actively configured to alert on detection
It passes when both components are in place and properly scoped to capture relevant root-level events from CloudTrail logs.
How to fix it
Using AWS CLI
Create a CloudWatch metric filter to match root user events:
aws logs put-metric-filter \
--log-group-name <trail-log-group-name> \
--filter-name root-account-usage \
--metric-transformations metricName=RootAccountUsage,metricNamespace=Security,metricValue=1 \
--filter-pattern '{ $.userIdentity.type = "Root" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != "AwsServiceEvent" }'
Create an SNS topic to receive alarm notifications:
aws sns create-topic --name root-account-usage-alerts
Subscribe a recipient to the SNS topic:
aws sns subscribe \
--topic-arn <sns-topic-arn> \
--protocol email \
--notification-endpoint security-team@example.com
Create the alarm in CloudWatch:
aws cloudwatch put-metric-alarm \
--alarm-name RootAccountUsageAlarm \
--metric-name RootAccountUsage \
--namespace Security \
--statistic Sum \
--period 300 \
--threshold 1 \
--comparison-operator GreaterThanOrEqualToThreshold \
--evaluation-periods 1 \
--alarm-actions <sns-topic-arn>
Replace all placeholder values with those specific to your environment.
Exceptions
If root account usage is entirely disabled or monitored through a centralized SIEM, this check may not apply. In such cases, documentation must confirm that equivalent monitoring and alerting measures are in place.
Further Resources
CloudTrail Multi-Region Logging