Ensure compliance by enabling logging of S3 data events in CloudTrail for all S3 buckets.
Rule | All S3 buckets should log S3 data events in CloudTrail |
Framework | NIST 800-53 Revision 5 |
Severity | ✔ Medium |
Rule Description:
All S3 buckets within the environment must have CloudTrail logging enabled for S3 data events, in compliance with NIST 800-53 Revision 5 requirements. This rule ensures that access to S3 data is properly logged and audited.
Troubleshooting Steps:
Necessary Code:
No specific code is required for this rule. However, the following AWS CLI command can be used to enable logging for an S3 bucket:
aws s3api put-bucket-logging --bucket <bucket_name> --logging-configuration '{"DestinationBucketName":"<destination_bucket_name>", "LogFilePrefix":"<prefix>"}'
Replace
<bucket_name>
with the name of the S3 bucket that needs logging and <destination_bucket_name>
with the bucket where CloudTrail logs will be stored. <prefix>
is an optional parameter used to specify a prefix for the log file names.Step-by-Step Guide for Remediation:
aws s3api put-bucket-logging --bucket <bucket_name> --logging-configuration '{"DestinationBucketName":"<destination_bucket_name>", "LogFilePrefix":"<prefix>"}'
Replace
<bucket_name>
with the name of the S3 bucket to enable logging for, <destination_bucket_name>
with the name of the bucket where CloudTrail logs will be stored, and <prefix>
with an optional prefix for the log file names.Note: It is recommended to automate the configuration of CloudTrail logging for S3 buckets using AWS CloudFormation, AWS CLI scripting, or infrastructure-as-code frameworks like AWS Cloud Development Kit (CDK).