S3 bucket access logging needs review

Collect the required S3 request records and check delivery and retention.

Description

S3 server access logs record requests and response status. Delivery can be delayed, and some requests may be missing.

Potential impact

Without another record, a missing log entry can make a failed request or unusual access hard to trace. The logs themselves can reveal request details.

Remediation

Set LoggingConfiguration to deliver logs to a separate bucket in the same AWS account and Region. Grant S3 permission to write there, limit who can read the logs, and set a retention period. Send a test request and check the destination after allowing for delivery time.

Examples

Before

yaml
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Properties:
      VersioningConfiguration:
        Status: Enabled

After

yaml
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Properties:
      VersioningConfiguration:
        Status: Enabled
      LoggingConfiguration:
        DestinationBucketName: !Ref AccessLogBucketName
        LogFilePrefix: loga/

Both examples enable versioning. The second sends access logs to the bucket named by AccessLogBucketName under the loga/ prefix.

References