Review S3 object-level CloudTrail data event coverage

Verify that CloudTrail data events cover the S3 object reads and writes you need.

Description

CloudTrail data events record S3 object operations such as reads, writes and deletes. Select the buckets and prefixes whose objects you need to audit.

Potential impact

Missing object events can leave downloads, overwrites or deletions unaccounted for.

Remediation

In event_selector, select AWS::S3::Object and set read_write_type = "All" when both reads and writes are required. Check the Regions and data-event costs. Test a read and a write on an in-scope test object, then verify delivery, alerts, log access and retention.

Examples

Both examples use the broad arn:aws:s3::: scope. Narrow it to the required buckets or prefixes and supply the destination bucket and delivery policy.

Before

hcl
resource "aws_cloudtrail" "example" {
  name                          = "tf-trail-foobar"
  s3_bucket_name                = aws_s3_bucket.foo.id
  s3_key_prefix                 = "prefix"
  include_global_service_events = false

  event_selector {
    include_management_events = true

    data_resource {
      type   = "AWS::S3::Object"
      values = ["arn:aws:s3:::"]
    }
  }
}

After

hcl
resource "aws_cloudtrail" "example" {
  name                          = "tf-trail-foobar"
  s3_bucket_name                = aws_s3_bucket.foo.id
  s3_key_prefix                 = "prefix"
  include_global_service_events = false

  event_selector {
    read_write_type           = "All"
    include_management_events = true

    data_resource {
      type   = "AWS::S3::Object"
      values = ["arn:aws:s3:::"]
    }
  }
}

Omitting read_write_type already defaults to All. Both examples cover reads and writes within the same selector scope.

References