Skip to content

Governance and loggingService 02 of 138 controls

AWS CloudTrail security hardening

Run one multi-Region organization trail into a locked log archive bucket with SSE-KMS, Object Lock, log file validation and alerts on tampering.

Published on Updated on 8 min readTags:#logging#governance#detection
On this page

AWS CloudTrail records the API calls made in your AWS accounts: who did what, from where, and when. Every investigation, compliance audit and most detection rules start from it. The default state is weak: the 90-day Event history in the console is not a trail, is not tamper evident, and ages out, and a trail created inside a single account can be stopped by any administrator of that account. Attackers know this. Stopping or deleting trails (MITRE ATT&CK T1562.008) and working from Regions nobody logs are standard moves after a credential leak, and incidents with missing logs are the ones that never get a clear answer. This page builds the baseline most teams should run: one multi-Region organization trail, delivered to a bucket in a dedicated log archive account, encrypted with a customer managed KMS key, protected by Object Lock, verified with log file validation, and watched for tampering.

Baseline controls

8 controlsCIS numbers refer to the CIS AWS Foundations Benchmark v7.1.0 unless another CIS benchmark is named; Security Hub CSPM IDs are listed where a control exists.
  1. 01Multi-Region organization trail logging

    Covers every account and Region, and member accounts cannot stop or delete it.

    How to check: aws cloudtrail describe-trails --query 'trailList[].IsMultiRegionTrail'
    Mapping: CloudTrail.1, CIS 4.1
  2. 02Log file validation enabled

    Signed hourly digests prove whether log files were changed or deleted.

    How to check: aws cloudtrail describe-trails --query 'trailList[].LogFileValidationEnabled'
    Mapping: CloudTrail.4, CIS 4.2
  3. 03Logs encrypted with a customer managed KMS key

    Reading logs then needs kms:Decrypt too, a second gate you control in the key policy.

    How to check: aws cloudtrail describe-trails --query 'trailList[].KmsKeyId'
    Mapping: CloudTrail.2, CIS 4.5
  4. 04Log bucket in a dedicated log archive account

    An admin in a workload or management account cannot delete what lives elsewhere.

    How to check: aws s3api get-object-lock-configuration --bucket org-cloudtrail-111122223333
  5. 05Bucket policy scoped to your trail with aws:SourceArn

    Prevents other trails or accounts from writing to, or polluting, your archive.

    How to check: aws s3api get-bucket-policy --bucket org-cloudtrail-111122223333
  6. 06Server access logging on the CloudTrail bucket

    Records who read the logs, the first question asked if they leak.

    How to check: aws s3api get-bucket-logging --bucket org-cloudtrail-111122223333
    Mapping: CloudTrail.7, CIS 4.4
  7. 07S3 data events logged for sensitive buckets

    Management events alone do not show who read or wrote objects during a breach.

    How to check: aws cloudtrail get-event-selectors --trail-name org-trail
    Mapping: S3.22, S3.23, CIS 4.8, CIS 4.9
  8. 08Alerts on trail changes and root activity

    Disabling logs is an early attacker step; you want to know within minutes.

    How to check: EventBridge > Rules: a rule matches StopLogging and DeleteTrail
    Mapping: CIS 5.3, CIS 5.5

Account layout

An organization trail is created once, from the management account or a CloudTrail delegated administrator, and AWS applies it to every member account, including accounts that join later. Member accounts can see it but cannot modify or delete it, so an attacker with admin in a workload account cannot simply run StopLogging.

The layout used by AWS Control Tower and the AWS Security Reference Architecture is a good default:

  • Management account: owns the organization and nothing else.
  • Log archive account: owns the S3 bucket and KMS key that receive CloudTrail, Config and VPC flow logs. Almost nobody has write access.
  • Security tooling account: delegated administrator for CloudTrail, GuardDuty, Security Hub CSPM and Config aggregation.
aws organizations enable-aws-service-access \
  --service-principal cloudtrail.amazonaws.com

aws cloudtrail register-organization-delegated-admin \
  --member-account-id 555566667777

If you use Control Tower, it already creates an organization trail into the log archive account. Do not add a second one that duplicates management events: the first copy is free, additional copies are billed. The Organizations page gives the SCP that denies cloudtrail:StopLogging, DeleteTrail and UpdateTrail to everyone except a break-glass role, which covers any account-level trails you keep.

Build the log archive bucket

In the log archive account, create a bucket with versioning and Object Lock. Object Lock can be enabled on existing versioned buckets, but enabling it at creation is simplest:

aws s3api create-bucket \
  --bucket org-cloudtrail-111122223333 \
  --region eu-west-1 \
  --create-bucket-configuration LocationConstraint=eu-west-1 \
  --object-lock-enabled-for-bucket

aws s3api put-object-lock-configuration \
  --bucket org-cloudtrail-111122223333 \
  --object-lock-configuration '{
    "ObjectLockEnabled": "Enabled",
    "Rule": { "DefaultRetention": { "Mode": "GOVERNANCE", "Days": 365 } }
  }'

aws s3api put-public-access-block \
  --bucket org-cloudtrail-111122223333 \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

Governance mode lets a principal with s3:BypassGovernanceRetention delete objects early, which helps while you tune retention. Once you are confident, switch to compliance mode, which nobody, including the root user, can shorten. Retention length is a legal and cost question: match it to your obligations.

Bucket policy

CloudTrail needs s3:GetBucketAcl on the bucket and s3:PutObject on two prefixes: one for the account that owns the trail and one for the organization. Scope both with aws:SourceArn so only your trail can write, and deny plain HTTP:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AWSCloudTrailAclCheck",
      "Effect": "Allow",
      "Principal": { "Service": "cloudtrail.amazonaws.com" },
      "Action": "s3:GetBucketAcl",
      "Resource": "arn:aws:s3:::org-cloudtrail-111122223333",
      "Condition": {
        "StringEquals": {
          "aws:SourceArn": "arn:aws:cloudtrail:eu-west-1:111122223333:trail/org-trail"
        }
      }
    },
    {
      "Sid": "AWSCloudTrailWrite",
      "Effect": "Allow",
      "Principal": { "Service": "cloudtrail.amazonaws.com" },
      "Action": "s3:PutObject",
      "Resource": [
        "arn:aws:s3:::org-cloudtrail-111122223333/AWSLogs/111122223333/*",
        "arn:aws:s3:::org-cloudtrail-111122223333/AWSLogs/o-exampleorgid/*"
      ],
      "Condition": {
        "StringEquals": {
          "s3:x-amz-acl": "bucket-owner-full-control",
          "aws:SourceArn": "arn:aws:cloudtrail:eu-west-1:111122223333:trail/org-trail"
        }
      }
    },
    {
      "Sid": "DenyInsecureTransport",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::org-cloudtrail-111122223333",
        "arn:aws:s3:::org-cloudtrail-111122223333/*"
      ],
      "Condition": { "Bool": { "aws:SecureTransport": "false" } }
    }
  ]
}

Here 111122223333 is the management account that owns the trail. Even when a delegated administrator creates the trail, it lives in the management account, so confirm the exact ARN with aws cloudtrail describe-trails after creation.

Server access logging on the log bucket

Enable S3 server access logging on the CloudTrail bucket, delivered to a separate bucket in the same account (CloudTrail.7, CIS 4.4). It tells you who read the logs:

aws s3api put-bucket-logging \
  --bucket org-cloudtrail-111122223333 \
  --bucket-logging-status '{
    "LoggingEnabled": {
      "TargetBucket": "org-cloudtrail-access-logs-111122223333",
      "TargetPrefix": "cloudtrail-bucket/"
    }
  }'

Encrypt with a customer managed KMS key

By default CloudTrail uses SSE-S3. CloudTrail.2 (CIS 4.5) asks for SSE-KMS, which adds a second permission gate: reading a log file requires kms:Decrypt on the key, not only s3:GetObject. Create the key in the log archive account and add statements like these to its key policy:

{
  "Sid": "AllowCloudTrailEncrypt",
  "Effect": "Allow",
  "Principal": { "Service": "cloudtrail.amazonaws.com" },
  "Action": "kms:GenerateDataKey*",
  "Resource": "*",
  "Condition": {
    "StringLike": {
      "kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:111122223333:trail/*"
    },
    "StringEquals": {
      "aws:SourceArn": "arn:aws:cloudtrail:eu-west-1:111122223333:trail/org-trail"
    }
  }
},
{
  "Sid": "AllowCloudTrailDescribeKey",
  "Effect": "Allow",
  "Principal": { "Service": "cloudtrail.amazonaws.com" },
  "Action": "kms:DescribeKey",
  "Resource": "*"
}

Grant kms:Decrypt only to the roles that investigate, such as the security tooling role and the SIEM ingestion role, with a kms:EncryptionContext:aws:cloudtrail:arn condition. Turn on automatic key rotation (KMS.4, CIS 4.6). The KMS page covers key policy structure in full.

Create the organization trail

From the management account or the delegated administrator:

aws cloudtrail create-trail \
  --name org-trail \
  --s3-bucket-name org-cloudtrail-111122223333 \
  --is-organization-trail \
  --is-multi-region-trail \
  --include-global-service-events \
  --enable-log-file-validation \
  --kms-key-id arn:aws:kms:eu-west-1:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab

aws cloudtrail start-logging --name org-trail

--is-multi-region-trail is what CloudTrail.1 and CIS 4.1 check: a trail that records read and write management events in every Region, including Regions you never use. Attackers like unused Regions because nobody looks there. Keep the trail multi-Region even if an SCP restricts Regions.

Verify

aws cloudtrail get-trail-status --name org-trail
aws cloudtrail describe-trails --trail-name-list org-trail

You want IsLogging: true, IsOrganizationTrail: true, IsMultiRegionTrail: true, LogFileValidationEnabled: true and a KmsKeyId, with no recent LatestDeliveryError.

Add data events selectively

Management events cover control plane calls such as CreateUser or PutBucketPolicy. Object reads, Lambda invocations and DynamoDB item access are data events, which are off by default and billed per event. Security Hub CSPM controls S3.22 and S3.23 check that S3 object-level writes and reads are logged. Use advanced event selectors to log only what matters:

aws cloudtrail put-event-selectors \
  --trail-name org-trail \
  --advanced-event-selectors '[
    {
      "Name": "Management events",
      "FieldSelectors": [ { "Field": "eventCategory", "Equals": ["Management"] } ]
    },
    {
      "Name": "Writes to payroll exports",
      "FieldSelectors": [
        { "Field": "eventCategory", "Equals": ["Data"] },
        { "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
        { "Field": "readOnly", "Equals": ["false"] },
        { "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::payroll-exports/"] }
      ]
    }
  ]'

Do not log data events for the CloudTrail bucket itself on the same trail: every log delivery generates an event, which generates another delivery.

Which events are worth paying for

Start from the question you will be asked after an incident: what did the attacker read or change? For most estates that points to object-level events on buckets holding customer data, exports and backups, and Lambda Invoke on functions that touch sensitive systems. Several calls that matter for investigations are already management events and cost nothing extra on the first copy: KMS Decrypt and GenerateDataKey, Secrets Manager GetSecretValue, and STS AssumeRole. Some teams exclude KMS events to cut volume with the eventSource selector; keep them, because they show who decrypted what and when.

CloudTrail Insights is a separate paid option that baselines API call rates (write management events, and data events on trails that log them) and API error rates, and records an event when activity departs from the baseline, such as a burst of RunInstances or a spike in AccessDenied. It is useful on the organization trail if you have no SIEM doing the same analysis, and redundant if you do.

Validate log integrity

With validation enabled (CloudTrail.4, CIS 4.2), CloudTrail writes a digest file every hour under AWSLogs/<account>/CloudTrail-Digest/. Each digest holds SHA-256 hashes of the log files delivered that hour, is signed with a private key held by CloudTrail, and references the previous digest, so deleting one breaks the chain. Run the check from any machine with read access to the bucket and decrypt access to the key:

aws cloudtrail validate-logs \
  --trail-arn arn:aws:cloudtrail:eu-west-1:111122223333:trail/org-trail \
  --start-time 2026-11-01T00:00:00Z \
  --end-time 2026-11-08T00:00:00Z \
  --verbose

The output reports valid, invalid, missing and modified files and digests. Make it part of incident response: validate the time window before relying on a log. Validation detects tampering; prevention comes from the separate account, the bucket policy and Object Lock.

Logging and detection

Changes to CloudTrail are themselves management events. Alert on them through an EventBridge rule in the management account (or on a central event bus):

{
  "source": ["aws.cloudtrail"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": ["cloudtrail.amazonaws.com"],
    "eventName": [
      "StopLogging", "DeleteTrail", "UpdateTrail",
      "PutEventSelectors", "PutInsightSelectors"
    ]
  }
}

Add rules for PutBucketPolicy, DeleteBucketPolicy and PutBucketLifecycleConfiguration on the log bucket, and for DisableKey and ScheduleKeyDeletion on the trail key. GuardDuty raises Stealth:IAMUser/CloudTrailLoggingDisabled when a trail is stopped or deleted, plus Policy:IAMUser/RootCredentialUsage for root activity; see the GuardDuty page.

Older CIS versions required sending the trail to CloudWatch Logs (CloudTrail.5). From CIS v3.0.0 that requirement is gone, but the monitoring section (section 5 in v7.1.0) still describes metric filters and alarms as manual checks: root activity, IAM policy changes, CloudTrail configuration changes, console sign-in failures, KMS key deletion, and security group, NACL, route table and VPC changes. If you do stream the trail to a log group, a root usage alarm looks like this:

aws logs put-metric-filter \
  --log-group-name org-trail-logs \
  --filter-name RootUsage \
  --filter-pattern '{ $.userIdentity.type = "Root" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != "AwsServiceEvent" }' \
  --metric-transformations metricName=RootUsageCount,metricNamespace=CISBenchmark,metricValue=1

aws cloudwatch put-metric-alarm \
  --alarm-name cis-root-usage \
  --namespace CISBenchmark --metric-name RootUsageCount \
  --statistic Sum --period 300 --evaluation-periods 1 \
  --threshold 1 --comparison-operator GreaterThanOrEqualToThreshold \
  --alarm-actions arn:aws:sns:eu-west-1:111122223333:security-alerts

For querying, CloudTrail Lake closed to new customers on May 31, 2026, and AWS points new users to Amazon CloudWatch; existing customers can keep it. For a new build, query the S3 archive with Athena or ship logs to your SIEM. In Security Hub CSPM, keep CloudTrail.1, .2, .4 and .7 passing; the Security Hub CSPM page shows how to enable them and run Prowler as a second opinion.

Common mistakes

  • Treating Event history as a trail. It covers 90 days of management events, is not exportable as evidence, and has no integrity validation.
  • Keeping the log bucket in the management account. Anyone with admin there can rewrite the bucket policy; use a dedicated log archive account.
  • A single-Region trail. Activity in Regions you do not use goes unrecorded, which is exactly where attackers start instances.
  • A duplicate organization trail next to Control Tower. You pay for a second copy of every management event without gaining coverage.
  • Granting kms:Decrypt broadly. Everyone who can decrypt can read every API call in the organization, including sensitive request parameters.
  • Logging data events for the trail's own bucket. It creates a feedback loop of deliveries and a large bill.
  • Never running validate-logs. Digests are useless if nobody checks them before an investigation relies on the logs.
  • Compliance mode Object Lock on day one. You cannot shorten it later, even as root, so start in governance mode.

References

Written by

Florian Amette

Security engineer writing practical, benchmark-aligned hardening baselines for AWS services, from the organization and identities to data, networks and workloads.

Related services

All services