Alerting on Unexpected and Anomalous Security Events
Security monitoring must notice the events that matter, such as root account use, disabled logging, unusual API activity or new external access, quickly and without overwhelming the team with noise. This lesson explains the sources of security alerts, how to configure alerts for known-bad events and for anomalies, and how to route, prioritise and enrich them.
Learning outcomes
After completing this lesson, you will be able to:
- Configure alerts for specific high-risk events using EventBridge rules and CloudWatch metric filters.
- Explain CloudTrail Insights and other anomaly-based detection sources.
- Describe alerts from GuardDuty, Security Hub, IAM Access Analyzer, Macie and AWS Config, and how they are combined.
- Design routing, prioritisation and enrichment of security alerts across an organisation.
Alerts for Known High-Risk Events
Some events are always worth an immediate alert, because they are rare in normal operations and dangerous if malicious. Examples are listed below with the event to match.
| Event | How to detect |
|---|---|
| Root user activity | EventBridge rule on events where userIdentity.type is Root; or CIS metric filter on CloudTrail logs |
| Console sign-in without MFA or failed sign-ins | AWS Console Sign In via CloudTrail events with additionalEventData.MFAUsed No, or failure responses |
| CloudTrail stopped, deleted or modified | StopLogging, DeleteTrail, UpdateTrail, PutEventSelectors |
| IAM policy, user or access key changes | CreateUser, CreateAccessKey, AttachRolePolicy, PutRolePolicy and similar |
| Security group or network ACL changes allowing broad access | AuthorizeSecurityGroupIngress with 0.0.0.0/0, CreateNetworkAclEntry |
| KMS key disabled or scheduled for deletion | DisableKey, ScheduleKeyDeletion |
| AWS Config recorder stopped | StopConfigurationRecorder, DeleteDeliveryChannel |
| S3 bucket policy or public access block changes | PutBucketPolicy, DeletePublicAccessBlock |
Two implementation paths exist. EventBridge rules on CloudTrail API call events give near-real-time alerts and can target remediation directly; for global services, they must be in us-east-1. CloudWatch metric filters and alarms on the trail's log group implement the CIS AWS Foundations Benchmark monitoring controls, which Security Hub's CIS standard checks for. Many organisations use EventBridge for response and metric filters for compliance with the benchmark.
{
"detail-type": ["AWS API Call via CloudTrail", "AWS Console Sign In via CloudTrail"],
"detail": {"userIdentity": {"type": ["Root"]}}
}Anomaly-Based Detection
Attackers often use legitimate APIs in unusual ways, which rule-based alerts miss. Several services detect anomalies.
CloudTrail Insights
When enabled on a trail, CloudTrail Insights learns the normal rate of write management API calls and the normal API error rate for the account and generates Insights events when activity deviates significantly, for example a sudden burst of DeleteBucket or RunInstances calls, or a spike in AccessDenied errors that may indicate reconnaissance. Insights events are delivered to the trail's bucket, to CloudWatch Logs and to EventBridge, where they can raise alerts.
GuardDuty
GuardDuty's machine learning detects anomalous API behaviour, such as an IAM principal calling APIs it has never used from an unusual location, and malicious network activity, as covered in the security controls module.
CloudWatch anomaly detection and log anomaly detection
Anomaly detection alarms on security-relevant metrics, such as failed sign-ins or WAF blocked requests, and log anomaly detection on security log groups surface unusual patterns without fixed thresholds.
Detect the unexpected
Findings from Security Services
Several services produce findings that should alert the right people. GuardDuty reports threats; Security Hub reports failed controls and aggregates other findings; IAM Access Analyzer reports new external access to resources and unused access; Macie reports sensitive data and bucket policy problems; Amazon Inspector reports software vulnerabilities and network exposure; and AWS Config reports non-compliant resources. All publish to EventBridge and most to Security Hub, so the common design routes everything through Security Hub and EventBridge in the security tooling account rather than configuring each service's notifications separately.
Routing, Prioritising and Enriching Alerts
An alerting design that sends every finding to everyone fails quickly. The practices below keep alerts actionable.
- Centralise: forward events and findings from all accounts and Regions to a central EventBridge bus and Security Hub aggregation Region.
- Prioritise: route critical and high severity, or alerts on production accounts, to paging; send lower severity to tickets or daily summaries. Security Hub automation rules adjust severity by account and resource.
- Suppress known benign activity: GuardDuty suppression rules, Security Hub suppression for accepted risks and exceptions documented by tags.
- Enrich: a Lambda function or Step Functions workflow adds context, such as the account owner, resource tags, recent deployments and related findings, before notifying.
- Measure: track alert volume, time to acknowledge and false positive rates, and tune rules.
A Security Alerting Baseline
A new organisation of 30 accounts asks for a security alerting baseline that catches high-risk actions immediately, detects unusual API behaviour and routes findings by severity.
-
High-risk events
Deploy EventBridge rules for root activity, CloudTrail and Config changes, IAM changes and KMS key deletion to every account with StackSets (IAM rules in us-east-1), forwarding to a central bus.
-
CIS compliance
Send the organisation trail to CloudWatch Logs and create the CIS metric filters and alarms; enable the CIS standard in Security Hub.
-
Anomalies
Enable CloudTrail Insights on the organisation trail and GuardDuty everywhere.
-
Routing
In the central account, critical and high findings page the on-call engineer through SNS; medium findings create tickets; an enrichment function adds account owner and recent changes.
An account suddenly makes hundreds of times more RunInstances calls than usual. Which CloudTrail feature detects this without a predefined threshold?
Show answer
CloudTrail Insights, which detects unusual rates of write management API calls (and error rates) against a learned baseline and emits Insights events.
Exam Tips
Remember for the exam
- Alert immediately on root activity, logging changes, IAM changes, broad network rules and KMS deletion using EventBridge rules (IAM in us-east-1) or CIS metric filters on CloudTrail logs.
- CloudTrail Insights detects unusual API call and error rates; GuardDuty detects anomalous behaviour and threats.
- Route GuardDuty, Security Hub, Access Analyzer, Macie, Inspector and Config findings through Security Hub and EventBridge centrally.
- Prioritise by severity and environment, suppress known benign findings and enrich alerts with context.