This rule ensures that all S3 buckets log S3 data events in CloudTrail for better monitoring and compliance.
Rule | All S3 buckets should log S3 data events in CloudTrail |
Framework | NIST 800-171 Revision 2 |
Severity | ✔ Medium |
Rule Description
All S3 buckets in the environment must have their S3 data events logged in AWS CloudTrail to comply with the NIST 800-171 Revision 2 security requirements. This ensures that all access and activities related to S3 buckets are recorded and can be audited for security and compliance purposes.
Troubleshooting Steps
If the S3 buckets are not logging S3 data events in CloudTrail, the following troubleshooting steps can be followed:
Necessary Codes
If S3 bucket logging for S3 data events in CloudTrail is not already enabled, the following AWS CLI command can be used to enable it:
aws s3api put-bucket-logging --bucket <bucket_name> --bucket-logging-status '{"LoggingEnabled":{"TargetBucket":"<log_bucket_name>","TargetPrefix":"<log_prefix>"}}'
Make sure to replace
<bucket_name>
, <log_bucket_name>
, and <log_prefix>
with the appropriate values.Step-by-Step Guide for Remediation
To ensure S3 buckets log S3 data events in AWS CloudTrail, follow these steps:
Open the AWS Management Console and navigate to the Amazon S3 service.
Identify the S3 buckets that need to have their S3 data events logged in CloudTrail.
Select one of the S3 buckets and click on its name to access the bucket details.
In the bucket details page, go to the "Properties" tab.
Under the "Management" section, click on "Edit" next to "Logging".
Enable logging for the bucket by checking the "Enabled" box.
Select or create a target S3 bucket where the CloudTrail logs will be stored. You can choose an existing bucket or create a new one.
Specify the log file prefix that will be used to organize the CloudTrail logs. Optionally, you can choose to include the account ID or region in the prefix.
Click on "Save" to enable the logging configuration for the bucket.
Repeat steps 3-9 for each remaining S3 bucket that needs to have S3 data events logged in CloudTrail.
Verify that the S3 bucket logging is successfully enabled by checking the CloudTrail service in the AWS Management Console.
To double-check the logging configuration using the AWS CLI, use the following command:
aws s3api get-bucket-logging --bucket <bucket_name>
Replace
<bucket_name>
with the name of the bucket you want to check.By following these steps, all S3 buckets will be configured to log S3 data events in AWS CloudTrail, meeting the NIST 800-171 Revision 2 compliance requirements.