More Info:
AWS S3 Buckets 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)
- Essential 8
- HITRUST CSF
- 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
- PCI
- 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 concise, console-based steps to enable an S3 bucket changes alarm using CloudWatch and CloudTrail.
Once complete, whenever S3 bucket configuration changes (covered by your filter) occur, CloudTrail logs them, the metric filter increments the
1. Ensure CloudTrail Is Enabled and Logging to CloudWatch Logs
- In the AWS Console, go to CloudTrail.
- In the left menu, select Trails.
- If you already have a trail:
- Click on the trail name.
- Under CloudWatch Logs, confirm:
- CloudWatch Logs log group is set.
- An IAM role is attached for CloudTrail to send logs to CloudWatch Logs.
- If not set, click Edit, then:
- Set CloudWatch Logs to Enabled.
- Choose or create a Log group.
- Choose or create a suitable IAM role.
- Save changes.
- If you do not have a trail:
- Click Create trail.
- Name the trail.
- For Storage location, choose/create an S3 bucket.
- For CloudWatch Logs, set to Enabled, and pick/create a log group and IAM role.
- Ensure Management events (Read and Write) are enabled.
- Create the trail.
2. Create a Metric Filter for S3 Bucket Changes
You will filter CloudTrail events that represent S3 bucket changes (such as PutBucketAcl, PutBucketPolicy, etc.).- Go to CloudWatch in the console.
- In the left menu, select Logs → Log groups.
-
Click the log group used by CloudTrail (e.g.,
/aws/cloudtrail/logs). - Choose the Metric filters tab.
- Click Create metric filter (or Add metric filter).
-
In Filter pattern, use something like:
(Adjust the event list to your policy as needed.)
- Click Next.
-
Under Assign metric, set:
- Filter name: e.g.,
S3BucketChangesFilter. - Metric namespace: e.g.,
Security/CloudTrail. - Metric name: e.g.,
S3BucketChanges. - Metric value:
1.
- Filter name: e.g.,
- Click Next, then Create metric filter.
3. Create a CloudWatch Alarm for S3 Bucket Changes
- In CloudWatch, go to Alarms → All alarms.
- Click Create alarm.
- Click Select metric.
- Choose Browse → go to the namespace you set (e.g.,
Security/CloudTrail) → select the S3BucketChanges metric. - Click Select metric.
- Configure the alarm:
- Statistic:
Sum. - Period: e.g.,
5 minutes(or as required). - Threshold type:
Static. - Condition:
Greater/Equalto1.
- Statistic:
- Click Next.
- Under Notification:
- Select an existing SNS topic or click Create new topic.
- Enter an email endpoint or other subscribers as needed.
- Click Next, give the alarm a name, e.g.,
Alarm-S3BucketChanges, and optional description. - Click Next, then Create alarm.
Once complete, whenever S3 bucket configuration changes (covered by your filter) occur, CloudTrail logs them, the metric filter increments the
S3BucketChanges metric, and the CloudWatch alarm triggers and sends a notification.Using CLI
Using CLI
Below is one concrete way to implement an “S3 bucket changes” CloudWatch alarm using AWS CLI:Goal: Alarm whenever someone changes S3 bucket configuration, such as ACLs/policies.
This uses CloudTrail → CloudWatch Logs → Metric Filter → CloudWatch Alarm.
Permissions policy:
(You must confirm the subscription email.)
This uses CloudTrail → CloudWatch Logs → Metric Filter → CloudWatch Alarm.
0. Prerequisites
- You have an S3 bucket with CloudTrail logs (or will create a new trail).
- You have (or will create) a CloudWatch Logs log group for CloudTrail.
- You have an SNS topic ARN to send the alarm notification to (or will create one).
1. Create / Configure CloudTrail to Send to CloudWatch Logs
1.1 Create the CloudWatch Logs log group (if not exists)
1.2 Create IAM role for CloudTrail to put logs into CloudWatch Logs
Trust policy:1.3 Create (or update) the CloudTrail trail
2. Create a Metric Filter for S3 Bucket Changes
We’ll match CloudTrail events that modify bucket configuration (common examples:PutBucketAcl, PutBucketPolicy, PutBucketCors, PutBucketLifecycleConfiguration, etc.).2.1 Define the metric filter
2.2 Create the metric filter
3. Create an SNS Topic for Alarm Notifications (if needed)
4. Create the CloudWatch Alarm
Alarm if any bucket-change event occurs in a 5‑minute period.5. Validate
- Make a bucket change (e.g., modify ACL or bucket policy).
- Check:
- CloudTrail logs show the event.
- The metric
Security/S3 : S3BucketChangesCountincreases. - The
S3BucketChangesAlarmmoves toALARMstate and sends an SNS notification.
Using Python
Using Python
To detect S3 bucket configuration changes with CloudWatch, you need:
- CloudTrail sending logs to a CloudWatch Logs log group
- A CloudWatch Logs metric filter for S3 bucket-change events
- A CloudWatch alarm on that metric
1. Prerequisites
boto3installed and configured with credentials/region:- An existing CloudTrail trail that:
- Logs management events
- Delivers to a CloudWatch Logs log group (e.g.,
/aws/cloudtrail/main)
boto3.cloudtrail.update_trail with CloudWatchLogsLogGroupArn).2. Recommended metric filter pattern
This pattern matches S3 bucket configuration changes in CloudTrail logs:3. Python script to create metric filter + alarm
This script will:- Create/overwrite a metric filter on the specified CloudWatch Logs log group
- Create/overwrite a CloudWatch alarm that fires when ≥ 1 S3 bucket change is detected in a 5‑minute period
4. Summary of remediation steps
- Ensure CloudTrail is enabled and sending logs to a CloudWatch Logs log group.
- Use the script (or similar boto3 code) to:
- Add a metric filter on that log group for S3 bucket config‑change events.
- Create a CloudWatch alarm on that metric (with SNS notifications if desired).
Using Terraform
Using Terraform
CLOUDTRAIL_LOG_GROUP_NAME CloudWatch Logs group; that trail configuration is managed separately. No resources above require forced replacement beyond standard Terraform create/update behavior.To verify, terraform plan should show:+createaws_sns_topic.s3_bucket_changes_topic+createaws_sns_topic_subscription.s3_bucket_changes_email(if kept)+createaws_cloudwatch_log_metric_filter.s3_bucket_changes_filter+createaws_cloudwatch_metric_alarm.s3_bucket_changes_alarm.

