Description
Monitor route and route table changes, including changes to subnet associations.
Potential impact
A wrong route can interrupt service or send traffic along an unintended path. Check gateways and security groups when assessing reachability.
Remediation
Send CloudTrail events to CloudWatch Logs. Set the alarm’s metric name and namespace to the filter’s output. Configure the comparison, statistic, period, and evaluation periods. Add an SNS notification action. Use matching test events to reach the alarm threshold and confirm a subscriber receives the alert.
Examples
The example covers creation, replacement, deletion, and selected association changes. Here the filter name matches the metric it emits, so the alarm can use the filter’s id as its metric name.
Before
resource "aws_cloudwatch_metric_alarm" "example" {
alarm_name = "CIS-3.13-RouteTableChanges"
metric_name = "XXXX NOT YOUR FILTER XXXX"
namespace = "CIS_Metric_Alarm_Namespace"
threshold = "1"
}
After
resource "aws_cloudwatch_log_metric_filter" "example" {
name = "CIS-RouteTableChanges"
pattern = "{ ($.eventName = CreateRoute) || ($.eventName = CreateRouteTable) || ($.eventName = ReplaceRoute) || ($.eventName = ReplaceRouteTableAssociation) || ($.eventName = DeleteRouteTable) || ($.eventName = DeleteRoute) || ($.eventName = DisassociateRouteTable) }"
log_group_name = aws_cloudwatch_log_group.CIS_CloudWatch_LogsGroup.name
metric_transformation {
name = "CIS-RouteTableChanges"
namespace = "CIS_Metric_Alarm_Namespace"
value = "1"
}
}
resource "aws_cloudwatch_metric_alarm" "example" {
alarm_name = "CIS-3.13-RouteTableChanges"
metric_name = aws_cloudwatch_log_metric_filter.example.id
namespace = "CIS_Metric_Alarm_Namespace"
threshold = "1"
}