Lesson 2 of 3 AWS CloudTrail

Configuring Trails and Protecting CloudTrail Logs

This lesson explains how trails deliver CloudTrail events to S3, and optionally CloudWatch Logs, for long-term retention and analysis, and how to protect log files from tampering.

Learning outcomes

After completing this lesson, you will be able to:

  • Create multi-Region trails.
  • Configure organisation trails.
  • Protect and validate log files.
  • Diagnose a trail that stopped delivering.

Creating trails

A trail delivers event log files to an S3 bucket, typically within about five minutes of the API call. A multi-Region trail, the default and best practice, records events from all Regions, including Regions enabled later. Trails can include management events (read, write or both), data events selected with advanced event selectors (for example only PutObject on one bucket prefix), network activity events and Insights events. Optionally, a trail also sends events to a CloudWatch Logs log group, which enables metric filters, alarms and Logs Insights queries; CloudTrail needs a role to write to the log group. The first copy of management events is free; additional copies and data events are charged.

True or false

Trails

Exam skills 1.1.1 · 4.1.5

Check facts about CloudTrail trails.

Log in to try this activity Interactive activities are free with an account.

Organization trails

An organisation trail, created in the management account or a delegated administrator account for CloudTrail, logs events for every account in an AWS Organizations organisation to one bucket, with a prefix per account ID. Member accounts can see the trail but cannot modify or delete it, and new accounts are included automatically. The usual design sends the logs to a bucket in a dedicated log archive account, as in an AWS Control Tower landing zone.

Protecting and validating log files

CloudTrail log files are encrypted with SSE-S3 by default; using SSE-KMS with a customer managed key adds an extra access control layer, but the key policy must allow cloudtrail.amazonaws.com to generate data keys, and readers need kms:Decrypt. The bucket policy must allow CloudTrail to call s3:GetBucketAcl and s3:PutObject, scoped with aws:SourceArn. Most delivery failures come from one of these two policies.

Log file integrity validation creates an hourly digest file containing SHA-256 hashes of the log files, signed by CloudTrail. The command aws cloudtrail validate-logs proves whether any log file was modified, deleted or added after delivery. Further protection comes from S3 Object Lock, MFA delete, versioning, lifecycle rules to cheaper storage and an SCP that denies cloudtrail:StopLogging and cloudtrail:DeleteTrail in member accounts.

aws cloudtrail create-trail --name org-trail --s3-bucket-name acme-log-archive-cloudtrail \
  --is-multi-region-trail --is-organization-trail --enable-log-file-validation \
  --kms-key-id arn:aws:kms:us-east-1:222233334444:key/1234abcd-12ab-34cd-56ef-1234567890ab
aws cloudtrail start-logging --name org-trail

aws cloudtrail validate-logs --trail-arn arn:aws:cloudtrail:us-east-1:111122223333:trail/org-trail \
  --start-time 2026-10-01T00:00:00Z

The following diagram shows the policies delivery depends on and the validation that follows.

What trail delivery needs and how logs are validated. The bucket policy must allow cloudtrail.amazonaws.com s3:GetBucketAcl and s3:PutObject, scoped with aws:SourceArn. With SSE-KMS, the key policy must allow CloudTrail to generate data keys, and readers need kms:Decrypt. Hourly signed digest files let validate-logs prove whether log files were changed.
The trail's status shows the latest delivery error, which names the failing permission.
Select all that apply

Protecting the evidence

Exam skills 4.1.5 · 4.2.2

Choose the controls that protect CloudTrail log files from tampering.

Log in to try this activity Interactive activities are free with an account.
Worked example

A trail that stopped delivering

After the security team switched the CloudTrail bucket to SSE-KMS with a new customer managed key, get-trail-status shows LatestDeliveryError: KMS.AccessDeniedException. The key policy allows only the security team's administrators. Adding a statement that lets cloudtrail.amazonaws.com call kms:GenerateDataKey* with a condition on aws:SourceArn for the trail, and kms:DescribeKey, restores delivery. Operators who read the logs also need kms:Decrypt on the key, otherwise they can list the objects but not open them.

Check yourself

How can you prove that delivered CloudTrail log files were not modified?

Show answer

Enable log file integrity validation and check the files with validate-logs against the signed digest files.

Exam Tips

Remember for the exam

  • Use a multi-Region trail; organisation trails cover every member account and cannot be changed by members.
  • Delivery errors usually come from the bucket policy or the KMS key policy.
  • Log file integrity validation uses signed digest files; validate with validate-logs.
  • Send the trail to CloudWatch Logs to use metric filters and alarms.
  • Protect logs with a separate log archive account, Object Lock and an SCP denying StopLogging.