CloudWatch Logs metric filter and alarm exist for changes to network gateways
cloudwatch_changes_to_network_gateways_alarm_configured
CloudWatch log metric filters and alarms for network gateway changes are identified by matching CloudTrail events such as CreateCustomerGateway, DeleteCustomerGateway, AttachInternetGateway, CreateInternetGateway, DeleteInternetGateway, and DetachInternetGateway in log groups that receive trail logs.
Risk
Without this monitoring, gateway changes can expose private networks to the Internet or break connectivity. Adversaries or mistakes can enable data exfiltration, bypass network inspection, and trigger outages via deletions or detachments, impacting confidentiality and availability.
prowler aws --checks cloudwatch_changes_to_network_gateways_alarm_configured
Recommendation
Send CloudTrail to CloudWatch Logs and create a metric filter for the listed gateway events with an alarm that notifies responders. Enforce least privilege for gateway modifications, require change approvals, and route alerts to monitored channels as part of defense in depth.
Remediation
- In the AWS Console, go to CloudWatch > Logs > Log groups and open the CloudTrail log group
- Create metric filter:
- Filter pattern: { ($.eventName = CreateCustomerGateway) || ($.eventName = DeleteCustomerGateway) || ($.eventName = AttachInternetGateway) || ($.eventName = CreateInternetGateway) || ($.eventName = DeleteInternetGateway) || ($.eventName = DetachInternetGateway) }
- Metric name: <example_resource_name>
- Metric namespace: <example_resource_name>
- Metric value: 1
- From the filter, choose Create alarm:
- Statistic: Sum, Period: 5 minutes, Threshold: >= 1, Evaluation periods: 1
- Create the alarm (actions optional)
Source Code
Resource Type
AwsCloudWatchAlarm
References
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudwatch-alarms-for-cloudtrail.html
- https://support.icompaas.com/support/solutions/articles/62000083807-ensure-a-log-metric-filter-and-alarm-exist-for-changes-to-network-gateways
- https://docs.aws.amazon.com/securityhub/latest/userguide/cloudwatch-controls.html#cloudwatch-12
- https://paper.bobylive.com/Security/CIS/CIS_Amazon_Web_Services_Foundations_Benchmark_v1_3_0.pdf