Triage and Remediation
Remediation
Using Console
Using Console
The VPC Changes Alarm is triggered when changes are made to the VPC configuration. To remediate this issue and set up the alarm, follow the steps below:
- Sign in to the AWS Management Console.
- Navigate to the CloudWatch dashboard at CloudWatch Console.
- In the left navigation panel, select Logs.
- Select the log group created for your CloudTrail trail event logs and click Create Metric Filter.
- On the Define Logs Metric Filter page, paste the following filter pattern inside the Filter Pattern box:
- Review the metric filter configuration and click Assign Metric.
-
On the Create Metric Filter and Assign a Metric page, perform the following:
- In the Filter Name box, enter a unique name for the new filter, e.g.,
VPCNetworkConfigChanges
. - In the Metric Namespace box, type
CloudTrailMetrics
. - In the Metric Name box, type
VpcEventCount
. - In the Metric Value box, enter
1
.
- In the Filter Name box, enter a unique name for the new filter, e.g.,
- Review the details and click Create Filter.
- On the current page, click Create Alarm.
- In the Create Alarm dialog box, provide the following:
- Name and Description: Enter a unique name and a short description for the CloudWatch alarm.
- Alarm Threshold: Set the threshold to trigger the alarm every time a configuration change involving an AWS VPC is made.
- Actions: Add notifications using an existing SNS topic.
- Alarm Preview: Set the period to
5 minutes
and chooseSum
for the statistic.
- Review the details and click Create Alarm. Once created, the new alarm will be listed on the Alarms page.
Using CLI
Using CLI
The “VPC Changes Alarm” is an AWS CloudWatch alarm that is triggered when there are changes made to the Virtual Private Cloud (VPC) configuration. To remediate this issue, you can follow these steps:
- Run the following command to create the necessary CloudWatch metric filter and associate it with the appropriate Amazon CloudTrail log group:
- Run the following command to create the AWS CloudWatch alarm:
Using Python
Using Python
To create a CloudWatch alarm using Python, follow these steps:These steps will create a CloudWatch alarm using Python that monitors VPC configuration changes.
- Import the necessary AWS SDK libraries in Python:
- Create a CloudWatch alarm:
- Replace the email topic ARN with your own.
-
Call the
create_cloudwatch_alarm()
function: