Lesson 1 of 3 Security Auditing and Monitoring

Implementing Robust Security Auditing with AWS CloudTrail and Service Logs

Auditing answers who did what, when, from where and to which resource. AWS CloudTrail records API activity, and service logs record network, access and application activity. This lesson explains CloudTrail event types, trails and organisation trails, protecting audit logs from tampering, integrating CloudTrail with CloudWatch Logs, and the service and application logs that complete an audit trail.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish between CloudTrail management events, data events, network activity events and Insights events, and event history and trails.
  • Explain how organisation trails centralise audit logs and how audit logs are protected from tampering.
  • Explain log file integrity validation and CloudTrail integration with CloudWatch Logs and EventBridge.
  • Identify the service and application logs that should be enabled for security auditing.

CloudTrail Events

AWS CloudTrail records actions taken by users, roles and AWS services as events. Each event records the identity (including the role session and source identity), the time, the source IP address and user agent, the service and API name, the request parameters, the response elements and whether the call succeeded. Events fall into several types, explained below.

Management events
Control-plane operations on resources, such as CreateBucket, RunInstances, AttachRolePolicy and ConsoleLogin. Recorded by default in event history.
Data events
Data-plane operations on or in resources, such as S3 GetObject and PutObject, Lambda Invoke, DynamoDB item operations and Secrets Manager GetSecretValue. High volume, charged, and recorded only when a trail or event data store is configured for them, with advanced event selectors to choose resources and actions.
Network activity events
API calls made through VPC endpoints from a VPC to AWS services, including denied calls, which helps detect data perimeter violations.
Insights events
Generated when CloudTrail detects unusual API call rates or error rates compared with a baseline, as described in the alerting lesson.

Event history shows the last 90 days of management events in each Region at no cost, searchable in the console, but it is not a durable audit log. A trail delivers events continuously to an S3 bucket, typically within about five minutes, and optionally to CloudWatch Logs, for retention and analysis. A trail should be multi-Region, so that activity in every Region, including unused ones, is captured; global service events such as IAM are included.

Organisation Trails and Protection

An organisation trail, created in the management account or by a delegated administrator for CloudTrail, logs events from every member account, including new ones, to a single bucket, with prefixes per account. Member accounts can see the trail but cannot modify or delete it. AWS Control Tower creates one automatically, delivering to the log archive account.

Audit logs must be protected from attackers who want to hide their activity. The controls below are combined.

  • Deliver logs to a bucket in a separate log archive account with restricted access, so that compromise of a workload account does not expose or allow deletion of logs.
  • Encrypt logs with SSE-KMS using a customer managed key whose policy allows CloudTrail to encrypt and only auditors to decrypt.
  • Enable S3 Object Lock in compliance mode or deny deletes in the bucket policy, enable versioning and MFA delete where appropriate.
  • Use SCPs to deny cloudtrail:StopLogging, DeleteTrail and UpdateTrail to everyone except a security role.
  • Alert on any attempt to change or stop logging, as described in the next lesson.

The following diagram shows the trail, the archive and the controls that protect them.

An organisation trail and the controls that protect it. A trail created in the management account or by a delegated administrator logs events from every member account, including new ones, to one bucket in a separate log archive account; member accounts can see the trail but not change it. The logs are encrypted with SSE-KMS under a customer managed key, the bucket uses Object Lock in compliance mode or denies deletes, SCPs deny stopping, deleting or updating the trail except for a security role, and alerts fire on any attempt.
Separate accounts, encryption, Object Lock and SCPs protect the audit record.
Select all that apply

Protect the audit trail

Exam skills 6.3.1 · 6.3.3

Identify the controls that make an organisation's CloudTrail logs complete and tamper-resistant.

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

Log File Integrity Validation

When log file integrity validation is enabled on a trail, CloudTrail creates a digest file every hour containing the SHA-256 hashes of the log files delivered in that hour, signed with a private key, and chains each digest to the previous one. The aws cloudtrail validate-logs command verifies that log files have not been modified, deleted or forged since delivery. Validation provides evidence for forensic investigations and audits that the logs are complete and authentic.

aws cloudtrail validate-logs \
  --trail-arn arn:aws:cloudtrail:eu-west-1:111111111111:trail/org-trail \
  --start-time 2026-10-01T00:00:00Z --end-time 2026-10-31T23:59:59Z --verbose

CloudTrail with CloudWatch Logs and EventBridge

A trail can also send events to a CloudWatch Logs log group, using a role that allows CloudTrail to write. This enables metric filters and alarms on API activity, such as the CIS benchmark alarms for root usage, unauthorised calls and IAM policy changes, and Logs Insights queries over recent events. Separately, EventBridge receives management events directly as AWS API Call via CloudTrail events, which is the lowest-latency path for automated responses. Long-term analysis uses Athena over the trail's S3 bucket, as described in the log analytics lesson; CloudTrail Lake, which offered a managed query store, is closed to new customers.

DestinationLatencyUse
S3 (trail)About 5 minutesDurable, protected archive; Athena analysis
CloudWatch Logs (trail)MinutesMetric filters, alarms, Logs Insights
EventBridgeNear real timeAutomated detection and response
Event historyMinutes90 days of management events for quick lookups

Service and Application Logging

CloudTrail does not record network traffic, requests to applications or database queries. A complete audit and security monitoring capability enables the following service logs, each delivered to a central, protected location.

LogRecordsDestination
VPC Flow LogsAccepted and rejected IP traffic metadata for interfaces, subnets or VPCsS3, CloudWatch Logs or Firehose
Route 53 Resolver query logsDNS queries made from VPCsS3, CloudWatch Logs or Firehose
ELB access logsRequests to load balancers with client, latency and statusS3
CloudFront logsViewer requests at the edgeS3, CloudWatch Logs or Firehose
S3 server access logs and CloudTrail data eventsRequests to buckets and objectsS3; trail
AWS WAF logsRequests evaluated by web ACLs and matched rulesS3, CloudWatch Logs or Firehose
API Gateway access logsAPI requests with caller and statusCloudWatch Logs or Firehose
RDS and Aurora log exportsDatabase audit, error and slow query logsCloudWatch Logs
EKS control plane logsAPI server, audit and authenticator logsCloudWatch Logs
Application logsApplication events, authentication and authorisation decisionsCloudWatch Logs through agents or drivers

Applications should log security-relevant events, such as sign-ins, permission changes and access to sensitive records, in structured JSON with the user identity and request ID, without logging secrets or unmasked personal data. AWS Config complements these logs by recording resource configuration history, and Config rules check that the logs above are enabled, for example vpc-flow-logs-enabled, cloudtrail-enabled, multi-region-cloudtrail-enabled and elb-logging-enabled.

Sort into groups

Which log records it?

Exam skills 6.3.3 · 6.3.1

Choose the log that records each kind of evidence.

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

An Auditable Organisation

A regulator requires that a company can show every API action in every account for seven years, prove that logs were not altered, and show network connections to its databases for one year.

  1. Trail

    Create a multi-Region organisation trail with log file integrity validation, delivering to a log archive account bucket encrypted with SSE-KMS and protected by Object Lock in compliance mode for seven years.

  2. Data events

    Add data events with advanced event selectors for S3 buckets and Secrets Manager secrets that hold regulated data.

  3. Network evidence

    Enable VPC Flow Logs for the database subnets to the archive bucket, with a one-year lifecycle.

  4. Protection and checks

    Apply SCPs that prevent stopping or deleting trails, and Config rules that verify the trail and flow logs remain enabled.

Check yourself

An investigator needs to prove that CloudTrail log files for a period have not been deleted or modified. What feature and command support this?

Show answer

Log file integrity validation, which creates signed, chained digest files, and the aws cloudtrail validate-logs command, which verifies the log files against them.

Exam Tips

Remember for the exam

  • Management events are recorded by default (90-day event history); data events and network activity events need a trail or event data store configuration.
  • Use a multi-Region organisation trail delivered to a log archive account with SSE-KMS, Object Lock and SCPs against StopLogging and DeleteTrail.
  • Log file integrity validation creates hourly signed digest files; verify with aws cloudtrail validate-logs.
  • Send trails to CloudWatch Logs for metric filter alarms; EventBridge receives API calls in near real time.
  • Enable VPC Flow Logs, Resolver query logs, ELB, CloudFront, WAF, API Gateway, RDS and EKS logs for complete auditing.