More Info:
AWS VPCs configuration changes should be monitored using CloudWatch alarms.Risk Level
MediumAddress
SecurityCompliance Standards
- APRA CPS 234 (Australia)
- AWS Well Architected Framework
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS AWS
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- HIPAA
- HITRUST CSF
- ISO 27001
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST
- NIST CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are the exact AWS Console steps to enable a “VPC Changes” alarm in CloudWatch.
Once this is in place, any matching VPC-related CloudTrail event will increment the
Prerequisite: Make sure CloudTrail is sending logs to CloudWatch Logs
- In the AWS Console, go to CloudTrail.
- In the left menu, select Trails.
- Click your trail name (or create one if none exist).
- Under CloudWatch Logs, ensure:
- CloudWatch Logs log group is set (e.g.,
/aws/cloudtrail/logs). - If not set:
- Click Edit.
- In CloudWatch Logs, choose Enabled.
- Select or create a Log group.
- Choose or create an IAM role as prompted.
- Save the changes.
- CloudWatch Logs log group is set (e.g.,
Step 1: Go to CloudWatch Logs
- Open CloudWatch in the AWS Console.
- In the left menu, choose Logs → Log groups.
- Click the log group used by CloudTrail (e.g.,
/aws/cloudtrail/logs).
Step 2: Create a Metric Filter for VPC Changes
- Inside the log group, go to the Metric filters tab.
- Click Create metric filter.
-
For Filter pattern, use a VPC-change pattern, for example:
(You can reduce or expand this list depending on exactly which VPC events you want.)
- Click Next.
-
Under Assign metric, configure:
- Filter name:
VPC-Changes-Filter - Metric namespace:
Security/VPC - Metric name:
VPCChanges - Metric value:
1
- Filter name:
- Click Next, then Create metric filter.
Step 3: Create a CloudWatch Alarm for This Metric
- Still in CloudWatch, in the left menu, select Alarms → All alarms.
- Click Create alarm.
- Click Select metric.
- Navigate to the metric:
- Custom namespaces → choose
Security/VPC. - Select the
VPCChangesmetric.
- Custom namespaces → choose
- Click Select metric.
Step 4: Configure Alarm Conditions
- Under Specify metric and conditions:
- Statistic:
Sum - Period:
5 minutes(or your preferred window). - Threshold type: Static.
- Whenever
VPCChangesis:>= 1.
- Statistic:
- Click Next.
Step 5: Configure Notification (SNS)
- Under Notification:
- For Alarm state trigger: In alarm.
- Select an SNS topic:
- Choose an existing topic (e.g.,
security-alerts)
or - Click Create new topic, name it (e.g.,
VPC-Changes-Topic), and enter one or more email addresses.
- Choose an existing topic (e.g.,
- Click Next.
Step 6: Name and Create the Alarm
- Alarm name:
VPC-Changes-Alarm. - Alarm description:
Alerts when VPC configuration changes are detected via CloudTrail. - Review the settings and click Create alarm.
Once this is in place, any matching VPC-related CloudTrail event will increment the
VPCChanges metric and trigger the CloudWatch alarm, sending a notification via SNS.Using CLI
Using CLI
Below is one way to remediate “VPC Changes Alarm Should Be Enabled” using AWS CLI by:
Attach a policy to allow writes to that log group:Now create the trail:Enable logging:
This will increment the metric
Get the ARN:Subscribe an email (or other endpoint):Confirm the subscription from your email.
- ensuring CloudTrail is logging to CloudWatch Logs
- creating a metric filter for VPC changes
- creating a CloudWatch alarm on that metric.
0. Prerequisites
- You have a CloudTrail trail sending logs to a CloudWatch Logs log group (say
/aws/cloudtrail/logs). - You know the region and account ID.
1. Confirm / Set CloudTrail → CloudWatch Logs
If you already have a trail withCloudWatchLogsLogGroupArn set, you can skip to step 2.Example: create a new trail that sends to /aws/cloudtrail/logs:cloudtrail-cw-trust.json (example):cloudtrail-cw-policy.json (replace region/account/log-group if needed):2. Create a CloudWatch Logs Metric Filter for VPC Changes
Pick the relevant VPC events. Common ones include:CreateVpc,DeleteVpc,ModifyVpcAttributeCreateSubnet,DeleteSubnet,ModifySubnetAttributeCreateRouteTable,DeleteRouteTable,AssociateRouteTable,DisassociateRouteTable,ReplaceRouteTableAssociationCreateRoute,DeleteRoute,ReplaceRouteCreateInternetGateway,DeleteInternetGateway,AttachInternetGateway,DetachInternetGatewayCreateNatGateway,DeleteNatGatewayCreateVpcPeeringConnection,DeleteVpcPeeringConnection, etc.
Security/VpcChanges by 1 every time a matching event appears.3. Create an SNS Topic for Alarm Notifications
4. Create the CloudWatch Alarm on the Metric
Example: alarm whenever at least 1 VPC change event occurs in a 5‑minute period.5. Validate
- Make a test VPC change (e.g., create or modify a subnet).
- Confirm:
- CloudTrail logs the event into the log group.
- The metric
Security/VpcChangesincrements. - The
VpcChangesDetectedalarm goes into ALARM state. - An SNS notification is received.
Using Python
Using Python
To remediate “VPC Changes Alarm Should Be Enabled” in AWS using Python, you typically need:
If you already have a central CloudTrail and log group, just set
- A CloudTrail that logs management events.
- That CloudTrail delivering logs to a CloudWatch Logs log group.
- A CloudWatch Logs metric filter that detects VPC-change API calls.
- A CloudWatch alarm on that metric.
boto3.1. Prerequisites
- Python 3.x
boto3installed:- AWS credentials configured (via
aws configure, environment variables, or instance profile). - An SNS topic ARN to receive the alarm notifications (or create one via console/CLI).
- Region:
us-east-1 - CloudTrail log group:
/aws/cloudtrail/vpc-changes - Metric name:
VPCChangeCount - Namespace:
SecurityMonitoring - Alarm name:
VPC_Changes_Alarm - SNS topic ARN:
arn:aws:sns:us-east-1:123456789012:security-alerts
2. Ensure CloudTrail Is Sending to a CloudWatch Logs Log Group
If you already have an org/tenant-wide CloudTrail that sends management events to CloudWatch Logs, you can reuse that log group and skip creating a new trail. Otherwise:logs_group_name to that existing log group and skip trail creation.3. Create a Metric Filter for VPC Changes
The filter pattern will match CloudTrail events for VPC‑related API calls.Common VPC‑change events:CreateVpc,DeleteVpc,ModifyVpcAttributeCreateSubnet,DeleteSubnet,ModifySubnetAttributeCreateRouteTable,DeleteRouteTable,AssociateRouteTable,DisassociateRouteTable,ReplaceRouteTableAssociationCreateRoute,DeleteRoute,ReplaceRouteCreateInternetGateway,AttachInternetGateway,DetachInternetGateway,DeleteInternetGatewayCreateNatGateway,DeleteNatGatewayCreateVpcPeeringConnection,DeleteVpcPeeringConnection,AcceptVpcPeeringConnection,RejectVpcPeeringConnectionCreateNetworkAcl,DeleteNetworkAcl,CreateNetworkAclEntry,DeleteNetworkAclEntry,ReplaceNetworkAclEntry- etc.
4. Create the CloudWatch Alarm on the Metric
Trigger if at least 1 VPC change occurs in a 5‑minute period:5. Quick Validation
- Make a small VPC change (e.g., create a test subnet).
- Wait a few minutes.
- Check:
- CloudWatch Logs: confirm CloudTrail events are arriving.
- CloudWatch Metrics →
SecurityMonitoring/VPCChangeCountshows datapoints. - CloudWatch Alarms:
VPC_Changes_Alarmmoves toALARMstate and sends SNS notification.
Using Terraform
Using Terraform
YOUR_EMAIL_ADDRESS and CLOUDTRAIL_LOG_GROUP_NAME with your actual values and confirm the SNS email subscription manually from your inbox.To verify, terraform plan should show 4 resources to add (aws_sns_topic, aws_sns_topic_subscription, aws_cloudwatch_log_metric_filter, and aws_cloudwatch_metric_alarm) and no changes/destroys for existing resources.
