Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below is how to set up an AWS Config changes alarm in CloudWatch using only the AWS Management Console. This follows the common CIS-style pattern: CloudTrail → CloudWatch Logs → Metric Filter → Alarm.
Prerequisites (quick checks)
- CloudTrail is enabled and recording management events.
- CloudTrail is delivering logs to a CloudWatch Logs log group.
Step 1 – (If needed) Send CloudTrail logs to CloudWatch Logs
- In the AWS console, go to CloudTrail.
- Click Trails in the left menu.
- Select your main trail (or create one if you don’t have it).
- In the CloudWatch Logs section:
- Click Edit (or Configure).
- Choose an existing log group or create a new one (e.g.,
/aws/cloudtrail/main). - Choose/create an IAM role as prompted.
- Save the configuration.
Step 2 – Create a metric filter for AWS Config changes
- Go to CloudWatch in the AWS console.
- In the left menu, under Logs, click Log groups.
-
Click the CloudTrail log group (e.g.,
/aws/cloudtrail/main). - Go to the Metric filters tab.
- Click Create metric filter.
-
In Filter pattern, paste this filter to catch AWS Config configuration changes:
(You can add/remove event names depending on what you want to monitor.)
- Click Next to test the pattern (optional but recommended), then Next.
-
Under Assign metric:
- Metric name:
AWSConfigChanges - Metric namespace:
SecurityMonitoring(or any name you prefer) - Metric value:
1
- Metric name:
- Click Next, then Create metric filter.
Step 3 – Create a CloudWatch alarm on the metric
- Still in CloudWatch, in the left menu click Alarms → All alarms.
- Click Create alarm.
- Click Select metric.
- Navigate to the namespace you used above (e.g., SecurityMonitoring).
- Select the metric AWSConfigChanges, then click Select metric.
-
Configure the alarm:
- Statistic:
Sum - Period: e.g.,
5 minutes - Threshold type:
Static - Condition: Greater/Equal
1 - Meaning: if at least one AWS Config change event occurs in 5 minutes, the alarm triggers.
- Statistic:
- Click Next.
-
Notification:
- Under Alarm state trigger, ensure In alarm is selected.
- Choose an existing SNS topic (for email/Slack/etc.) or Create new topic:
- Enter topic name (e.g.,
aws-config-changes-alerts). - Enter your email address (or other endpoint).
- After creation, confirm the subscription via the email you receive.
- Enter topic name (e.g.,
- Click Next.
-
Name and description:
- Name:
AWSConfigChangesAlarm - Description:
Alarm on AWS Config configuration changes via CloudTrail
- Name:
- Click Next, review, then Create alarm.
Step 4 – (Optional) Test the alarm
- Make a benign AWS Config change (e.g., adjust a Config rule or delivery channel in a test account).
- Wait for the CloudWatch period (e.g., 5–10 minutes).
- Confirm:
- The CloudWatch alarm transitions to ALARM.
- The SNS notification is received (email, etc.).
Using CLI
Using CLI
Below are end‑to‑end AWS CLI steps to create a CloudWatch alarm for AWS Config changes (using CloudTrail → CloudWatch Logs → metric filter → alarm).Assumptions:
Assume the log group name is:
This will publish a metric
Replace:Then use the returned
Once done, any AWS Config configuration recorder or delivery channel change will generate a CloudTrail event, be picked up by the metric filter, and trigger the CloudWatch alarm, satisfying “AWS Config Changes Alarm Should Be Enabled.”
- You already have a CloudTrail trail sending events to a CloudWatch Logs log group (e.g.,
/aws/cloudtrail/logs). - You have AWS CLI configured with appropriate permissions.
1. Identify the CloudTrail log group
If you don’t know the log group, list CloudWatch log groups:2. Create a metric filter for AWS Config changes
Filter on AWS Config API calls that change the configuration recorder or delivery channel:Security/AWSConfigChanges with value 1 each time one of those events appears.3. Create a CloudWatch alarm on the metric
Create an alarm that triggers if at least 1 such event occurs in a 5‑minute window:REGIONwith your region (e.g.,us-east-1)ACCOUNT_IDwith your AWS account IDSECURITY-TOPICwith an existing SNS topic ARN for notifications.
TopicArn in --alarm-actions and subscribe your email:Once done, any AWS Config configuration recorder or delivery channel change will generate a CloudTrail event, be picked up by the metric filter, and trigger the CloudWatch alarm, satisfying “AWS Config Changes Alarm Should Be Enabled.”
Using Python
Using Python
Below is a step‑by‑step approach and example Python (boto3) code to ensure an “AWS Config Changes” alarm exists in CloudWatch. This follows the typical CIS-style requirement: a CloudWatch Logs metric filter on CloudTrail logs for AWS Config changes, plus a CloudWatch alarm on that metric.
You’ll use this in the CloudWatch Logs metric filter.
1. Prerequisites
- You have:
- A CloudTrail trail delivering logs to a CloudWatch Logs log group (e.g.
/aws/cloudtrail/logs). - An SNS topic ARN for alarm notifications (e.g.
arn:aws:sns:us-east-1:111122223333:SecurityNotifications).
- A CloudTrail trail delivering logs to a CloudWatch Logs log group (e.g.
- Python 3 and
boto3installed. - AWS credentials configured (env vars, profile, or instance role).
2. Define the metric filter pattern
CIS-like pattern for AWS Config configuration recorder changes:3. Python script to create/update metric filter and alarm
Adjust the variables at the top as needed (region, account ID, log group, SNS topic, metric/alarm names).4. Run the script
5. Verify
- In CloudWatch Console:
- Logs → Log groups → select your CloudTrail log group → Metric filters: confirm
AWSConfigChangesFilter. - Alarms → All alarms: confirm
AWSConfigChangesAlarmis present, in OK state.
- Logs → Log groups → select your CloudTrail log group → Metric filters: confirm
- Trigger a test (e.g. modify Config recorder) and confirm:
- Metric increments.
- Alarm enters ALARM state.
- SNS notification is received.
Using Terraform
Using Terraform
YOUR_EMAIL@example.com before alerts will be delivered.For verification, terraform plan should show these resources as + create (and no unexpected changes to existing CloudWatch alarms, SNS topics, or log groups).
