Skip to main content

Triage and Remediation

Remediation

Using Console

Below are step‑by‑step instructions using only the AWS Management Console, assuming you already have a CloudTrail trail logging management events in all regions to a CloudWatch Logs log group. If not, I’ll include the prerequisite steps first.

0. Prerequisite: Ensure CloudTrail is Logging to CloudWatch Logs

  1. Open CloudTrail console.
  2. Go to Trails in the left menu.
  3. Select your main trail (or create one if you don’t have it).
  4. In the trail details page, under CloudWatch Logs, choose Edit (or Configure).
  5. For CloudWatch Logs log group, either:
    • Choose an existing log group, or
    • Type a new log group name (e.g., /aws/cloudtrail/management).
  6. Select or create an IAM role as prompted to allow CloudTrail to write to CloudWatch Logs.
  7. Save changes and confirm events are being delivered (check the log group after a few minutes).

1. Create a Metric Filter for Network ACL Changes

  1. Open CloudWatch console.
  2. In the left navigation pane, select Logs → Log groups.
  3. Click the log group where CloudTrail is sending logs (e.g., /aws/cloudtrail/management).
  4. Select the Metric filters tab.
  5. Click Create metric filter.
  6. In Filter pattern, paste:
  7. Click Next to test; choose a log event sample if available and verify it would match where appropriate.
  8. Click Next.
  9. Under Assign metric, configure:
    • Filter name: NetworkACLChanges
    • Metric namespace: Security/CloudTrail (or similar)
    • Metric name: NetworkACLChangesCount
    • Metric value: 1
    • Leave default for others unless you have a standard.
  10. Click Next, then Create metric filter.

2. Create a CloudWatch Alarm on That Metric

  1. In CloudWatch, go to Alarms → All alarms.
  2. Click Create alarm.
  3. Click Select metric.
  4. Navigate to your metric via:
    • BrowseSecurity/CloudTrail (or your namespace) → Metrics with no dimensions (or the one you chose), then select NetworkACLChangesCount.
  5. Click Select metric.
  6. Configure the metric and conditions:
    • Statistic: Sum
    • Period: e.g., 5 minutes (or 1 minute if you want very fast alerts).
    • Threshold type: Static
    • Whenever NetworkACLChangesCount is… Greater than or equal to
    • Threshold value: 1.
    This means any NACL change in that period will fire the alarm.
  7. Click Next.
  8. Configure notification:
    • Under Notification, choose In alarm.
    • For Select an SNS topic:
      • Choose an existing topic (e.g., security-alerts), or
      • Click Create new topic, give it a name, and enter your email address (or distribution list).
    • Confirm subscription from the email if you created a new topic.
  9. Click Next.
  10. Name and description:
    • Alarm name: NetworkACLChangesAlarm
    • Alarm description: Alarm when any Network ACL is created, deleted, or modified.
  11. Review the configuration, then click Create alarm.

3. Validate

  1. Make a test NACL change (e.g., add a temporary rule in a test VPC).
  2. Wait for CloudTrail to deliver the log and CloudWatch to evaluate the metric (1–5 minutes, depending on your period).
  3. Confirm:
    • The metric NetworkACLChangesCount shows a data point > 0.
    • The alarm enters ALARM state.
    • A notification is sent to your SNS subscribers.
Once this is in place, “Network ACL Changes Alarm” is effectively enabled and will notify you of any NACL modifications recorded by CloudTrail.
Below are the CLI-focused remediation steps to ensure you have a CloudWatch alarm on Network ACL changes (via CloudTrail logs).Assumptions (adjust names/regions as needed):
  • Region: us-east-1
  • Log group: /aws/cloudtrail/netacl-logs
  • Metric name: NetworkAclChanges
  • Metric namespace: SecurityMonitoring
  • Alarm name: NetworkAclChangesAlarm
  • SNS topic (for notifications): arn:aws:sns:us-east-1:123456789012:SecurityAlerts

1. Ensure CloudTrail is logging to CloudWatch Logs

If you already have a CloudTrail configured to send logs to CloudWatch Logs, skip to step 2.

1.1 Create a log group (if needed)

1.2 Allow CloudTrail to write to the log group (IAM role/policy)

Create an IAM role for CloudTrail (if you don’t have one). Example trust policy file trust-policy.json:
Attach permissions policy file cloudtrail-cwlogs-policy.json:

1.3 Create / update CloudTrail to use that log group

Enable logging (if not already):

2. Create a CloudWatch Logs Metric Filter for NACL changes

Create a filter pattern file nacl-filter-pattern.txt:
Then create the metric filter:

3. Create a CloudWatch alarm on the metric

Example: alarm when at least 1 NACL change occurs in a 5‑minute period.
(Ensure the SNS topic exists and subscriptions are confirmed.)

4. Validate

  • Generate a test NACL change (e.g., add/remove an entry).
  • Confirm:
    • The CloudTrail event appears in the log group.
    • The metric NetworkAclChanges increments.
    • NetworkAclChangesAlarm transitions to ALARM and SNS notification is sent.
To fix this, you need to (1) ensure NACL changes are logged by CloudTrail, (2) create a CloudWatch Logs metric filter for those events, and (3) create a CloudWatch alarm on that metric. Below is a concise, step-by-step Python (boto3) example.Assumptions:
  • You already have:
    • A CloudTrail trail delivering logs to a CloudWatch Logs log group (e.g., /aws/cloudtrail/logs)
    • An SNS topic ARN to notify (e.g., arn:aws:sns:us-east-1:123456789012:security-notifications)
Replace all placeholder values with your actual ones.

1. Make sure CloudTrail logs to CloudWatch Logs

If your trail is not yet configured to send to CloudWatch Logs:
Ensure the IAM role has permissions to write to that log group.

2. Create a CloudWatch Logs metric filter for NACL changes

Events to monitor (CloudTrail eventName):
CreateNetworkAcl, CreateNetworkAclEntry, DeleteNetworkAcl, DeleteNetworkAclEntry, ReplaceNetworkAclEntry, ReplaceNetworkAclAssociation

3. Create a CloudWatch alarm on that metric


4. (Optional) Verify the configuration

You can list the metric filters and alarms to verify:
Once this is in place, any NACL change recorded in CloudTrail will produce a CloudWatch metric data point and trigger the alarm, sending a notification via SNS.
Notes:
  • This creates a new metric filter and CloudWatch alarm, matching the provided CLI remediation.
  • You must have an existing SNS topic for EXISTING_SNS_TOPIC_ARN, and you must subscribe an endpoint (e.g., email) to that topic manually in AWS or via separate Terraform.
Verification with terraform plan should show:
  • aws_cloudwatch_log_metric_filter.network_acl_changes to be created (or updated if it already exists but differs).
  • aws_cloudwatch_metric_alarm.network_acl_changes_alarm to be created (or updated if it already exists but differs).