Logging solutions: CloudTrail, CloudWatch Logs, Security Lake and network logs
On Day 2 you met GuardDuty, Security Hub, Config and State Manager, which read logs and raise findings. Today you build the logs underneath: CloudTrail event types and an organization trail, a protected Log Archive bucket with integrity validation, CloudWatch Logs agents and central logging accounts, Security Lake and CloudTrail Lake, and the network logs that match each threat.
Skill 1.2.1 log sourcesSkill 1.2.2 configure loggingSkill 1.2.3 storage and data lakesSkill 1.2.6 network log sources~90 min read + 30 min lab
01
Log sources and where they go
Day 1 and Day 2 used services that read logs: GuardDuty, Security Hub and Config. Today is about the logs themselves. Skill 1.2.1 asks you to pick the right log source for a requirement and the right place to store it. A detection is only as good as the log behind it, and you can’t turn on a log after an incident to see what happened before.
Most AWS logs land in one of three targets: CloudWatch Logs, Amazon S3 or Amazon Data Firehose. In a multi-account setup, they then flow to a central Log Archive account that workload teams can’t change.
Concept profile
Log source selection
often confused with Using CloudTrail for everything
?What is it?
Matching each security question to the log that actually records the answer: who called an API, which IP talked to which IP, which domain was looked up, which HTTP request was blocked, what happened inside the operating system.
⚙How does it work?
API activity: CloudTrail (management, data, network activity and Insights events).
The organization trail is there, but this account has no flow logs and no DNS query logs. A data-exfiltration investigation here would have no network evidence.
Exam-style scenario
After an incident, a security engineer must find out which external domains a compromised EC2 instance contacted and how much data it sent to each IP address. CloudTrail is enabled in all Regions. What should the company have enabled?
A. CloudTrail data events for S3.
B. Route 53 Resolver query logging and VPC Flow Logs for the VPC.
C. CloudTrail Insights.
D. AWS Config recording for EC2.
Show the worked answer
Answer: B
Resolver query logs show the domain names; flow logs show IPs, ports and bytes.
Why not the others
A: Records S3 object API calls, not network traffic.
C: Finds unusual API call or error rates, not network flows.
D: Records configuration changes, not traffic.
How the exam tests this
“Who made an API call”→ CloudTrail.
“Which IPs talked, how many bytes”→ VPC Flow Logs.
“Which domains were resolved”→ Resolver query logs.
“Log files inside the OS”→ Unified CloudWatch agent.
“Logs can’t be changed by workload admins”→ Central Log Archive account.
CloudTrail records API activity. It has four event types, and the exam loves to ask which one is needed and which are on by default. Only management events are logged by default; data, network activity and Insights events must be turned on and cost extra.
Concept profile
CloudTrail event types
often confused with CloudTrail Event history
?What is it?
Four kinds of records: management events (control plane), data events (operations on data inside a resource), network activity events (API calls made through your VPC endpoints) and Insights events (unusual API call or error rates).
⚙How does it work?
Management: CreateUser, PutBucketPolicy, RunInstances, ConsoleLogin. Logged by trails and event data stores by default. One copy to S3 is free.
Data: S3 GetObject/PutObject, Lambda Invoke, DynamoDB item calls and many more. Off by default, charged, high volume. Choose them with advanced event selectors (filter by resource ARN, eventName, read-only and more).
Network activity: eventCategory = NetworkActivity. Records calls through a VPC endpoint to services such as S3, EC2, KMS, Secrets Manager and STS, including calls denied by the endpoint policy (errorCode = VpceAccessDenied).
Insights: builds a baseline and creates an event when the API call rate or API error rate moves away from it. Works for management events, and on trails also for data events.
Event history keeps 90 days of management events per Region for free, without any trail.
{ }Structure
Only management events are on by default.
⇄Event types vs CloudTrail Event history
Trail
Event history
Retention
As long as you keep the S3 objects
90 days
Event types
All four (you choose)
Management events only
Scope
Multi-Region, can be organization-wide
One account, one Region
Setup
You create it
Always on
Exam hint
“keep for 7 years”, “all accounts”
“quick look at last week”
!Common mistakes the exam tests
Thinking a trail logs S3 object reads by default: those are data events.
Using S3 server access logs when the question needs prefix filtering or integrity validation: that’s CloudTrail data events.
Enabling Insights but logging only read management events: the API call rate Insight needs write management events.
Expecting real-time delivery: trail logs arrive in about 5 minutes on average, not guaranteed. For near-real-time actions use EventBridge.
Logging all data events for every bucket: costly. Use advanced event selectors to pick sensitive buckets or actions.
✓Benefits and use cases
Prove who changed what, from where (sourceIPAddress, userAgent).
Watch access to sensitive S3 data or Lambda functions.
Spot credentials from outside your org using your VPC endpoints.
Advanced event selectors
Advanced event selectors are the modern way to choose what a trail or event data store records. Each selector is a list of field conditions such as eventCategory, resources.type, resources.ARN, eventName and readOnly. They let you log, for example, only write data events on one bucket, which keeps cost low. A multi-Region trail (the console default) records all enabled Regions; a single-Region trail can only be made with the CLI or API.
Think of it like · a school’s records
Different books for different things.
AWS concept
Familiar thing
Management events
≈
The principal’s office book: new staff, room changes, rule changes
Data events
≈
The library loan book: who borrowed which book, page by page
Network activity events
≈
The side-gate book: who used the staff gate, and who was turned back
Insights events
≈
The teacher who notices ‘the photocopier was used 50 times more than usual today’
Event history
≈
A whiteboard that is wiped after 90 days
Trail
≈
Copies sent every few minutes to the town archive
Real AWS example · log network activity events for S3, only denials
An advanced event selector on a trail. Field names are from the CloudTrail guide.
A denied call shows who tried to use your endpoint with credentials your endpoint policy doesn’t allow, for example a key from another organization.
Exam-style scenario
A company uses VPC endpoint policies so that only principals from its own organization can reach S3 through its endpoints. The security team wants a record of every attempt by outside credentials that the endpoint policy blocks, without logging all S3 object activity. What should it configure?
A. S3 server access logs on every bucket.
B. CloudTrail network activity events for s3.amazonaws.com with errorCode VpceAccessDenied.
C. CloudTrail data events for all S3 buckets.
D. VPC Flow Logs on the endpoint ENIs.
Show the worked answer
Answer: B
Network activity events record calls through VPC endpoints, and the filter keeps only denials.
Why not the others
A: S3 access logs don’t record requests denied by the endpoint policy.
C: Logs all object activity (high cost) and still isn’t about the endpoint.
D: Shows IP flows, not the identity or the API call.
How the exam tests this
“Logged by default”→ Management events only.
“Who downloaded objects from a bucket”→ Data events.
“Activity through our VPC endpoints”→ Network activity events.
“Sudden spike in API calls or errors”→ CloudTrail Insights.
“Last 90 days, no setup”→ Event history.
Must remember
Four types: management, data, network activity, Insights.
Skill 1.2.2 names the first big setup step: an organization trail. It logs every member account into one S3 bucket, usually in a dedicated Log Archive account (the AWS Security Reference Architecture and Control Tower both use this pattern). Then you protect that bucket so logs can’t be changed or deleted, and you prove they weren’t with log file validation.
Concept profile
Organization trail
often confused with Per-account trails
?What is it?
A CloudTrail trail created in the management account or a delegated administrator account that applies to every account in the AWS Organization, including accounts that join later.
⚙How does it work?
A copy of the trail appears in each member account with the same name and ARN. Members can see it but can’t stop logging, change it or delete it.
Logs go to one bucket under AWSLogs/o-orgid/account-id/ (a folder per member account). By default only the management account can read them.
Console-created organization trails are multi-Region.
New accounts are added automatically; when an account leaves, its trail copy is removed but old logs stay.
Event history in the management account still shows only that account’s events.
{ }Structure
One trail for all accounts, one protected bucket, a chain of signed digests.
⇄Organization trail vs Per-account trails
Organization trail
Per-account trails
Who creates it
Management or delegated admin
Each account
Members can disable it
No
Yes, an admin can
New accounts
Covered automatically
Need setup each time
Bucket
One central bucket
Often one per account
Exam hint
“all current and future accounts”
Rarely right
!Common mistakes the exam tests
Creating the trail in a member account without delegated administrator rights: the organization option won’t show.
Putting the log bucket in the management account: best practice is a separate Log Archive account.
Turning on log file validation and thinking logs are now protected: it only detects changes. Use Object Lock, versioning, MFA delete or deny policies to prevent them.
Copying logs to another bucket and expecting validate-logs to work there: the CLI validates logs where CloudTrail delivered them.
Forgetting the KMS key policy: CloudTrail (and log readers) must be allowed to use the SSE-KMS key.
✓Benefits and use cases
Audit evidence for every account, from day one.
A tamper-evident record for investigations and courts.
Guardrail that workload admins can’t switch off.
Protecting the Log Archive bucket with Object Lock
S3 Object Lock stores objects in a write-once-read-many (WORM) way and needs versioning. In governance mode, users with s3:BypassGovernanceRetention can still delete or shorten retention, which is good for testing. In compliance mode, no one, not even the root user, can delete a locked version or shorten its retention until it ends. A legal hold blocks deletion with no end date until someone with s3:PutObjectLegalHold removes it. Add an SCP that denies cloudtrail:StopLogging and cloudtrail:DeleteTrail as a second guard.
Think of it like · a bank’s CCTV system
Recording every branch and keeping tapes safe.
AWS concept
Familiar thing
Organization trail
≈
Head office installs cameras in every branch, and branch managers can’t switch them off
Log Archive account
≈
The tapes go to a separate vault, not the branch office
Log file validation
≈
Each tape gets a sealed, numbered sticker; a broken seal shows tampering
Digest chain
≈
Each day’s list of seals also records yesterday’s list
Object Lock compliance
≈
A time-lock safe that even the bank owner can’t open early
Legal hold
≈
A court order: keep this tape until the judge says otherwise
Real AWS example · validate CloudTrail logs
Run against the trail; the CLI reads digests and checks every hash and signature.
$ aws cloudtrail validate-logs \
--trail-arn arn:aws:cloudtrail:us-east-1:111122223333:trail/org-trail \
--start-time 2026-10-01T00:00:00Z --end-time 2026-10-02T00:00:00Z
Validating log files for trail arn:aws:cloudtrail:us-east-1:111122223333:trail/org-trail
Results requested for 2026-10-01T00:00:00Z to 2026-10-02T00:00:00Z
Results found for 2026-10-01T00:00:00Z to 2026-10-02T00:00:00Z:
24/24 digest files valid
1340/1341 log files valid, 1/1341 log files INVALID
One file was changed or deleted after delivery. The digest chain tells you which one.
Exam-style scenario
An auditor requires that CloudTrail logs from all 60 accounts, including future accounts, are kept for 7 years, that no one (including administrators) can delete them early, and that the company can prove no log was changed. What is the best design?
A. A trail in each account writing to a local bucket with versioning.
B. An organization trail to an S3 bucket in a Log Archive account with log file validation, versioning and S3 Object Lock in compliance mode with 7-year retention.
C. CloudTrail Event history plus Config.
D. An organization trail with Object Lock in governance mode only.
Show the worked answer
Answer: B
The organization trail covers current and future accounts; compliance mode prevents deletion by anyone; validation proves integrity.
Why not the others
A: Local admins can delete logs, and new accounts need setup.
C: Event history keeps only 90 days.
D: Governance mode can be bypassed by users with special permission.
How the exam tests this
“All accounts, members can’t turn it off”→ Organization trail.
CloudWatch Logs: agent, central account and subscriptions
The second example in skill 1.2.2 is a dedicated CloudWatch logging account, and the third is the CloudWatch Logs agent. CloudWatch Logs is where you search and alarm on logs quickly. The exam asks how logs get in (agent, service integrations) and how they get to one central account.
Concept profile
Unified CloudWatch agent
often confused with Deprecated CloudWatch Logs agent
?What is it?
Software you install on EC2 instances and on-premises servers (Linux and Windows) that sends log files and OS-level metrics (memory, disk, processes) to CloudWatch.
⚙How does it work?
Install with Systems Manager (Run Command or Distributor) or a package, then give it a JSON config: which files, which log group, which metrics.
Store the config in Parameter Store so every instance uses the same settings.
The instance role needs CloudWatchAgentServerPolicy; on-premises servers use credentials of an IAM user or role profile.
The old CloudWatch Logs agent is deprecated. If your instances use IMDSv2, you must use the unified agent.
Lambda, ECS (awslogs driver), API Gateway and many other services write to CloudWatch Logs without an agent.
{ }Structure
Agent in, then three ways to reach a central account.
⇄Unified agent vs Deprecated CloudWatch Logs agent
Unified CloudWatch agent
Old CloudWatch Logs agent
Status
Current, recommended
Deprecated
Logs + metrics
Both
Logs only
IMDSv2
Supported
Not supported (must switch)
Windows + Linux
Yes
Limited
Config
JSON, can live in Parameter Store
Old Python-style file
!Common mistakes the exam tests
Expecting memory or disk metrics from EC2 without an agent: default EC2 metrics don’t include them.
Forgetting the IAM role on the instance: the agent runs but nothing arrives.
Choosing the old Logs agent on IMDSv2-only instances.
Granting the agent role broad logs:* on *: limit it to the needed log groups.
Leaving log groups at Never expire retention and paying forever, or setting retention too short for audit rules.
✓Benefits and use cases
Collect /var/log/secure or Windows Security event logs for detection.
Get memory and disk metrics for alarms.
One agent for EC2 and on-premises servers.
Three ways to centralize logs in a logging account
1. Subscription filters. A log group can have up to 5 subscription filters (older material says 2). A filter streams matching events in real time to Kinesis Data Streams, Firehose, Lambda or OpenSearch in the same account. For cross-account, the central account creates a CloudWatch Logs destination that points to a Kinesis stream or Firehose stream, plus a destination access policy that lets source accounts call logs:PutSubscriptionFilter. The log group and the destination must be in the same Region. An account-level subscription filter policy covers many log groups at once.
2. Organization log centralization. A newer CloudWatch feature: the management account or a delegated administrator creates centralization rules (with trusted access turned on) that copy new log events from chosen accounts, OUs and Regions into one destination account, with an optional backup Region. Only data that arrives after the rule is created is copied. Name patterns such as ${source.accountId} keep accounts apart.
3. Cross-account observability. A monitoring account links to source accounts so people can view and query their logs, metrics and traces from one console. The data is not copied; it stays in each source account.
Think of it like · a chain of restaurants
Getting every kitchen’s notes to head office.
AWS concept
Familiar thing
Unified CloudWatch agent
≈
A cook in each kitchen who copies the order slips and temperature readings
Old Logs agent
≈
An old cook who can’t use the new ticket machine (IMDSv2)
Subscription filter + destination
≈
A courier who rushes selected slips to head office as they are written
Destination access policy
≈
Head office’s list of which restaurants may send couriers
Centralization rule
≈
Head office photocopies every new slip from all branches automatically
Cross-account observability
≈
Head office can look through each kitchen’s window, but the slips stay there
Real AWS example · cross-account subscription to a central Firehose
In the central account (111122223333) create the destination and allow the source account (444455556666).
You can use an organization ID condition in the destination policy instead of listing every account.
Exam-style scenario
A company with 80 accounts wants application logs from every account available in near real time in a central security account, where they are delivered to S3 and a third-party SIEM. Source account teams must not manage the delivery pipeline. What should the security team build?
A. Ask each team to export log groups to S3 every night.
B. In the central account, a CloudWatch Logs destination backed by Firehose with a destination policy for the organization; account-level subscription filter policies in source accounts send logs to it.
C. Cross-account observability only.
D. Install a SIEM agent in every account.
Show the worked answer
Answer: B
Destinations plus subscription filters stream logs in real time across accounts; Firehose delivers to S3 and the SIEM.
Why not the others
A: Export tasks are batch, not near real time.
C: Lets you view logs, but doesn’t deliver them to S3 or a SIEM.
D: More software to manage and no central AWS pipeline.
How the exam tests this
“OS log files and memory metrics from EC2”→ Unified CloudWatch agent.
“IMDSv2 instances, which agent”→ Unified (old Logs agent deprecated).
Security Lake, CloudTrail Lake and third-party tools
Skill 1.2.3 asks you to build log storage and data lakes and connect third-party security tools. The AWS answer is Amazon Security Lake: it collects security logs from many accounts and Regions, converts them to one schema (OCSF) and stores them in an S3 data lake that you own. Partners and SIEMs then read from it as subscribers.
Concept profile
Amazon Security Lake
often confused with CloudTrail Lake
?What is it?
A managed security data lake. It turns on collection of native AWS logs across your organization, normalizes them to the Open Cybersecurity Schema Framework (OCSF), stores them as Apache Parquet in S3 in your account, and shares them with subscribers.
⚙How does it work?
Enable it from a delegated administrator account in AWS Organizations, for chosen accounts and Regions.
Native sources: CloudTrail management and data events (S3, Lambda), VPC Flow Logs, Route 53 Resolver query logs, Security Hub CSPM findings, EKS audit logs, AWS WAF logs. Security Lake turns these on for you; you don’t need a separate trail for them.
Custom sources (firewalls, endpoint tools, SaaS) write OCSF data in Parquet to their own prefix.
Rollup Regions combine data from contributing Regions; retention is set with S3 lifecycle rules.
Subscribers: data access (reads S3 objects, notified by SQS or an HTTPS endpoint) or query access (queries tables in place with Athena, through Lake Formation).
{ }Structure
Sources in, OCSF Parquet stored once, many subscribers out.
Managed event data store (ORC), not in your bucket
Query
Athena / partners via Lake Formation
Built-in Trino SQL, dashboards
Retention
S3 lifecycle (you choose)
Up to 3,653 days (1-year extendable) or 2,557 days (7-year pricing)
New customers
Open
Closed from 31 May 2026
!Common mistakes the exam tests
Thinking Security Lake needs your own trail or flow log setup first: it can enable those native sources itself.
Giving a SIEM vendor access to the raw bucket by hand: use a subscriber so access is scoped and managed.
Mixing up subscriber types: data access copies the data out; query access queries in place.
Forgetting Lake Formation for query subscribers: table permissions are granted there.
Recommending CloudTrail Lake to a brand-new customer in late 2026: it is closed to new customers from 31 May 2026.
✓Benefits and use cases
One normalized place for all security logs in an organization.
Feed SIEM or XDR partners without building pipelines.
Long-term, low-cost retention in your own S3.
CloudTrail Lake event data stores
A CloudTrail Lake event data store keeps events in a managed, immutable store and lets you run SQL (Trino) queries over them, join several stores, and use dashboards. One store holds one kind of data: CloudTrail events, Insights events, AWS Config items, Audit Manager evidence or events from outside AWS sent with PutAuditEvents. An organization event data store covers all member accounts. Retention is up to 3,653 days with one-year extendable pricing or 2,557 days with seven-year pricing. You can federate a store with the Glue Data Catalog to query it in Athena. If you add your own KMS key, you can’t change it later. New: CloudTrail Lake is no longer open to new customers from 31 May 2026; existing customers keep using it. AWS’s own migration advice for CloudTrail Lake users is Amazon CloudWatch: since December 2025 CloudWatch can ingest CloudTrail organization-wide (also VPC and WAF logs), normalize to OCSF with pipelines, and expose the data as Apache Iceberg tables in S3 Tables for Athena; existing event data stores can be exported with aws logs create-import-task.
Think of it like · a city library system
Many sources, one catalogue.
AWS concept
Familiar thing
Security Lake
≈
The central library that collects books from every branch
OCSF
≈
Every book gets the same catalogue card format, whatever the publisher
Parquet in S3
≈
Books stored on shelves the city owns, not the publisher’s
Data access subscriber
≈
A partner library that borrows copies of every new book
Query access subscriber
≈
A researcher who reads in the reading room without taking books out
CloudTrail Lake
≈
A special archive that keeps only the city council’s minutes, with its own search desk
Real AWS example · add a SIEM as a query subscriber
Give a partner account query access to VPC Flow Logs and CloudTrail data in Security Lake.
Use --access-types S3 for a data access subscriber that reads the Parquet objects and gets new-object notifications.
Exam-style scenario
A security team wants to send CloudTrail, VPC Flow Logs, Route 53 Resolver logs and findings from 40 accounts, plus logs from an on-premises firewall, to a third-party SIEM in one common schema, without building custom ETL. What should it use?
A. CloudWatch Logs subscription filters to Lambda that rewrites each format.
B. Amazon Security Lake with native AWS sources, a custom source for the firewall in OCSF, and the SIEM as a subscriber.
C. A CloudTrail Lake event data store for all sources.
D. Athena tables on each raw S3 bucket.
Show the worked answer
Answer: B
Security Lake normalizes AWS sources to OCSF and accepts custom OCSF sources; the SIEM subscribes.
Why not the others
A: Custom code for every format is the ETL they want to avoid.
C: CloudTrail Lake doesn’t ingest flow logs or DNS logs, and is closed to new customers.
D: Different schemas and no normalization.
How the exam tests this
“Normalize security logs to one schema”→ Security Lake (OCSF).
“Send lake data to a SIEM”→ Security Lake subscriber.
“Query in place without copying”→ Query access subscriber (Lake Formation).
“SQL over CloudTrail events for years”→ CloudTrail Lake event data store (existing customers).
“Bring non-AWS logs to Security Lake”→ Custom source in OCSF Parquet.
Must remember
Security Lake = OCSF + Parquet in your S3.
Six native sources incl. WAF, EKS audit, Resolver.
Subscribers: data access vs query access.
CloudTrail Lake: Trino SQL, up to 3,653 days.
CloudTrail Lake closed to new customers 31 May 2026.
Skill 1.2.6 asks you to choose logs from the network design and the threat. Ask where the attack travels. Traffic between instances shows up in VPC Flow Logs. Traffic between VPCs and on-premises through a transit gateway shows up in Transit Gateway flow logs. DNS-based threats show up in Resolver query logs. Web attacks show up in WAF, ALB and CloudFront logs.
Concept profile
VPC Flow Logs
often confused with Traffic Mirroring
?What is it?
Metadata records about IP traffic to and from network interfaces: source and destination IP and port, protocol, packets, bytes, action (ACCEPT or REJECT), and optional fields such as VPC, subnet, instance ID, TCP flags and traffic path.
⚙How does it work?
Create at the VPC, subnet or network interface level, for ACCEPT, REJECT or ALL traffic.
Send to CloudWatch Logs, S3 or Data Firehose. Choose the default or a custom record format.
Maximum aggregation interval is 10 minutes or 1 minute; on Nitro instances records are always 1 minute or less.
You can’t change a flow log after creation (fields, role, format): delete and recreate it.
Not captured: traffic to the Amazon DNS server, instance metadata (169.254.169.254), Time Sync (169.254.169.123), DHCP, ARP, Windows license activation and mirrored source traffic.
{ }Structure
Six network and edge logs, and what each one sees.
⇄VPC Flow Logs vs Traffic Mirroring
VPC Flow Logs
Traffic Mirroring
Content
Metadata (5-tuple, bytes, action)
Full packets, including payload
Cost and volume
Low
High (needs a collector)
Use
Who talked to whom, blocked traffic
Deep packet inspection, IDS
DNS names
No
Only if you decode packets
Exam hint
“which IPs”, “rejected traffic”
“inspect packet contents”
!Common mistakes the exam tests
Looking for DNS lookups in flow logs: queries to the Amazon DNS server aren’t captured. Use Resolver query logs.
Expecting flow logs to show traffic between VPCs at the transit gateway: use Transit Gateway flow logs, which also show packets dropped by a blackhole or no route.
Trying to edit a flow log to add fields: you must recreate it.
Using flow logs to see HTTP paths or SQL injection: that needs WAF or ALB access logs.
Thinking a REJECT in flow logs tells you whether a security group or a NACL blocked it: you must reason from both directions.
✓Benefits and use cases
Detect port scans and unexpected outbound traffic.
Troubleshoot security group and NACL rules.
Feed GuardDuty-style analysis or Security Lake.
The other network and edge logs
Transit Gateway flow logs capture traffic through a transit gateway, with fields like tgw-attachment-id and packets-lost-blackhole, to CloudWatch Logs, S3 or Firehose. Only the transit gateway owner can create them. Route 53 Resolver query logs record DNS queries from your VPCs, from on-premises through inbound endpoints, through outbound endpoints, and the action of DNS Firewall rules. Answers served from the Resolver cache are not logged again. You can share a query logging configuration with other accounts through AWS RAM. ELB access logs are off by default, delivered every 5 minutes on a best-effort basis. CloudFront has standard logs and real-time logs (to Kinesis Data Streams within seconds, with a sampling rate). AWS WAF logs go to CloudWatch Logs, S3 or Firehose, and the destination name must start with aws-waf-logs-.
S3 server access logs vs CloudTrail data events. Server access logs are free to deliver (you pay storage), arrive within a few hours, and also record authentication failures and lifecycle actions. CloudTrail data events arrive in minutes, support prefix filtering and integrity validation, and are the recommended choice for auditing. Many teams use both.
Think of it like · an airport
Different logs for different parts of the journey.
AWS concept
Familiar thing
VPC Flow Logs
≈
The gate log: which passenger went through which gate and when, not what was in their bag
Transit Gateway flow logs
≈
The transfer desk log for passengers changing between terminals
Resolver query logs
≈
The information desk record of every destination people asked about
ALB / CloudFront logs
≈
The check-in desk record of every boarding pass request
WAF logs
≈
Security screening notes: who was stopped and which rule caught them
Traffic Mirroring
≈
Opening and copying every bag’s contents
Real AWS example · VPC flow log record and the query that finds it
A default-format record showing a rejected SSH attempt, and a custom-format flow log with extra fields.
Fields in the first line: version, account, ENI, source IP, destination IP, source port, destination port 22, protocol 6 (TCP), packets, bytes, start, end, action, log status.
Exam-style scenario
A company connects 30 VPCs and its data centre through a transit gateway. Security wants to detect hosts using DNS tunnelling to exfiltrate data and to see which VPC attachments carry traffic to an unexpected on-premises network. Which TWO log sources best meet this?
A. Route 53 Resolver query logs for the VPCs and inbound/outbound endpoints.
B. Transit Gateway flow logs.
C. CloudTrail management events.
D. S3 server access logs.
E. CloudFront standard logs.
Show the worked answer
Answer: A and B
DNS tunnelling shows in query names and volumes; cross-VPC and hybrid traffic shows per attachment in Transit Gateway flow logs.
Why not the others
C: API calls, not DNS or traffic.
D: S3 requests only.
E: Edge web requests, not internal traffic.
How the exam tests this
“DNS exfiltration / which domains”→ Resolver query logs.
“Traffic between VPCs via TGW, blackhole drops”→ Transit Gateway flow logs.
“Need packet payloads”→ Traffic Mirroring, not flow logs.
Cheatsheet extras: protecting, keeping and troubleshooting CloudTrail logs
The cheat sheet has a full chapter on securing CloudTrail log files: stop unauthorized access, stop deletion, keep logs for X years, read them as an auditor, and fix delivery. Today’s lecture covered trails, the organization trail and validation; this section joins them into one protection design and adds the troubleshooting checklist and the four-service comparison the cheat sheet says to learn.
Concept profile
CloudTrail log file protection
often confused with Log file integrity validation
?What is it?
The set of controls that keep CloudTrail log files secret, unchanged and kept long enough: where they are stored, who can read or delete them, how they are encrypted, and how long they are kept.
⚙How does it work?
Log files are encrypted by default with SSE-S3. Choose SSE-KMS with your own key for separate key permissions and an extra audit trail of decrypts.
Logs stay in S3 until you delete them. Use S3 Lifecycle to move them to S3 Glacier storage classes and expire them after the required years.
Turn on an SNS notification for each delivered log file. The message only contains the bucket and object key, never the events, so it is safe to send widely.
Readers need CloudTrail read permissions (the managed policy AWSCloudTrail_ReadOnlyAccess, older name AWSCloudTrailReadOnlyAccess) plus s3:GetObject on the bucket and kms:Decrypt if SSE-KMS is used.
Prevent deletion with a deny in the bucket policy, versioning, Object Lock (or MFA Delete), and by keeping the bucket in an account that workload admins can’t reach.
{ }Structure
Keep it away, keep it safe, prove it and keep it.
⇄Log file protection vs log file integrity validation
CloudTrail log file protection
Log file integrity validation
Goal
Stop reading, changing or deleting logs
Detect that a log file changed or disappeared
Tools
Separate account, bucket policy, SSE, Object Lock, MFA Delete, lifecycle
SHA-256 hashes in hourly digest files signed with RSA
Prevents tampering?
Yes
No, it only proves it
How to use it
Set up once on the bucket and account
aws cloudtrail validate-logs
Exam hint
“prevent deletion”, “only auditors can read”
“prove the logs were not modified”
!Common mistakes the exam tests
Choosing validation when the question says prevent; validation only detects.
Adding “enable SSE on the bucket” because logs are “not encrypted”: they already are (SSE-S3).
Giving an auditor IAM user access to every account instead of read-only access to one central log bucket.
Storing logs only in the same account the attacker controls: use an organization trail into a Log Archive account.
Using CloudWatch Logs as the only store: retention is per log group and admins in that account can delete it.
✓Benefits and use cases
Evidence that holds up in an investigation.
Long-term, low-cost retention for compliance (for example 7 years).
Least-privilege read access for auditors.
Think of it like · CCTV tapes in a bank
The tapes prove what happened only if the robbers can’t reach them.
AWS concept
Familiar thing
Log Archive account
≈
Tapes stored in a different building with its own guards
SSE-S3 / SSE-KMS
≈
Tapes kept in a locked box; with KMS you hold the key yourself
Object Lock
≈
A time lock on the box: nobody opens it before the date
Integrity validation
≈
A signed seal on each tape: a broken seal proves tampering
SNS file notification
≈
A note “new tape filed in box 17”, without the footage
Lifecycle to Glacier
≈
Old tapes moved to the cheap basement archive, shredded after 7 years
Real AWS example · a bucket policy statement for an organization trail plus a lifecycle rule
The CloudTrail statement limits writes to one trail; the lifecycle rule keeps 90 days online and 7 years in archive.
A wrong prefix or trail ARN in this statement is the most common reason logs stop arriving. 2,557 days is about 7 years.
Exam-style scenario
A company must keep CloudTrail logs from all accounts for 7 years. Logs must be online for 90 days, nobody (including account admins) may delete or change them during retention, and auditors need read-only access without access to workload accounts. Which design meets all requirements?
A. A trail in each account delivering to a local bucket with versioning; give auditors IAM users in every account.
B. An organization trail delivering to a bucket in a Log Archive account with Object Lock in compliance mode, log file validation on, a lifecycle rule to an archive class after 90 days and expiry after 7 years, and a read-only auditor role in that account.
C. Send CloudTrail to CloudWatch Logs with 7-year retention and give auditors CloudWatchReadOnlyAccess.
D. An organization trail to the management account bucket with MFA Delete, and a weekly copy to Glacier.
Show the worked answer
Answer: B
The separate account and Object Lock prevent changes, validation proves integrity, lifecycle meets cost and retention, and the auditor role is read-only in one place.
Why not the others
A: Logs stay where admins can delete them, and auditors get access to every account.
C: Admins in that account can delete the log group, and this costs more for 7 years.
D: Management account is not the place for logs; MFA Delete still lets the root user with the device delete them.
Facts the cheat sheet tests about CloudTrail
CloudTrail records API calls only. It does not record an SSH or RDP login to an instance or the commands typed there; use the CloudWatch agent (OS logs) or Session Manager session logging (Day 4).
Log files are delivered about every 5 minutes on average; this isn’t guaranteed, so use EventBridge when you need seconds.
A trail that applies to all Regions is automatically added to new Regions. Event times are in UTC.
You can have up to 5 trails per Region; use separate trails or advanced event selectors to send data events and management events to different buckets.
Data events (S3 object, Lambda invoke, DynamoDB item calls) are off by default and are the usual reason for a surprise CloudTrail bill.
When logs stop arriving: a checklist
Check
Why it breaks delivery
Is logging on? (get-trail-status → IsLogging)
Someone called StopLogging
Does the bucket and prefix in the trail still exist?
Renamed or deleted bucket or prefix
Bucket policy allows cloudtrail.amazonaws.coms3:PutObject on the right path
Policy rewritten, wrong prefix, wrong account or org path, an old statement limited to certain Regions
Requester Pays is off
CloudTrail can’t deliver to a Requester Pays bucket
KMS key policy lets CloudTrail use the key
SSE-KMS trails need kms:GenerateDataKey* for CloudTrail
The four logging services side by side
Service
Records
Answers
Not for
CloudTrail
API calls and console sign-ins
Who did what, when, from which IP
Performance, OS logins
CloudWatch (Logs, metrics)
Application and OS logs, metrics
How is it performing? Any errors?
Who called an AWS API (unless CloudTrail sends logs to it)
AWS Config
Resource configuration over time
What changed and is it compliant?
Who made the change
VPC flow logs
IP traffic metadata per network interface
Which IPs and ports talked, accepted or rejected
Packet contents, DNS names
“Logs must be encrypted” is a trick when the trail already exists: CloudTrail log files are already encrypted with SSE-S3. Pick SSE-KMS only when the question asks for your own key, key separation or tighter control over who can decrypt.
14. CloudTrail Lake: closed to new customers 31 May 2026.
15. Flow logs miss Amazon DNS, IMDS, DHCP; can’t edit.
16. Resolver logs: VPC, endpoints, DNS Firewall; no cache hits.
17. CloudTrail logs: SSE-S3 by default; SSE-KMS for your own key.
18. Validation detects; Object Lock + separate account prevent.
19. No logs? bucket/prefix, policy, Requester Pays, KMS.
10
Core quiz
Check the basics first. Pick an answer, then press Check.
11
Hard quiz
Harder than most real exam questions on purpose, with one “choose two” and one matching question. Aim for 9 out of 12 before Day 4.
12
Practice test questions (from your mock exams)
These 9 questions match today’s topics: 8 come from your own SCS-C03 mock exams and 1 was added to cover a recent AWS change. Wording was modernized where services were renamed (for example CloudWatch Events is now Amazon EventBridge), and each answer was checked against current AWS behavior; where the mock’s answer key was wrong, the explanation says so. The source (mock and question number) is at the end of each explanation.
13
Hands-on lab (30 minutes, low cost)
Open CloudTrail → Event history and filter by Event name = ConsoleLogin. Note that this works with no trail at all.
Create a trail (or reuse one) with log file validation on, writing to a new S3 bucket. Wait about an hour, then run aws cloudtrail validate-logs --trail-arn ... --start-time .... Delete one log object and run it again to see the INVALID result.
In a test VPC, create a VPC flow log to a CloudWatch Logs log group with a 1-minute aggregation interval and REJECT traffic only. Try to SSH to an instance from an address the security group doesn’t allow and find the REJECT record.
Turn on Route 53 Resolver query logging for the same VPC to the same log group. From the instance run dig example.com twice and check that the second, cached answer isn’t logged again.
Set the log group retention to 1 day, then open Logs Insights and run fields @timestamp, @message | sort @timestamp desc | limit 20 to preview Day 4.
Clean up: delete the flow log, the Resolver query logging configuration and the log group; stop and delete the extra trail (a second trail’s management events are charged); empty and delete the bucket; terminate the instance. Don’t enable Security Lake or CloudTrail data events for all buckets in a personal account: both can grow costs quickly.