Free tech learning for everyone, from basics to pro

AWS SecurityCloud SecurityIntermediate

AWS logging and detection: CloudTrail, CloudWatch, GuardDuty and Security Hub

In short: CloudTrail records who did what through the AWS API, CloudWatch stores logs and metrics and raises alarms, GuardDuty spots suspicious behaviour, AWS Config tracks resource changes, and Security Hub gathers findings in one place. Turn them on in every account and region, protect the logs, and alert on high-value events.

Why cloud logging is different

In the cloud almost everything is an API call: starting a server, changing a firewall rule, reading a secret. That is good news for defenders, because a full record of those calls exists if you switch it on and keep it safe. Attackers know this, so one of their first moves is often to disable logging. Your design must make that hard and noisy.

AWS detection servicesSecurity Hubcentral findingsCloudTrailAPI activityCloudWatchmetrics, logs,alarmsGuardDutythreat detectionAWS Configresource changesInspectorvulnerabilitiesDetectiveinvestigation
Figure 1. Logging and detection services feed findings into Security Hub for a single view.

What each service does

ServiceRoleExample question it answers
AWS CloudTrailAudit log of management (and optionally data) API eventsWho deleted this security group, and from which IP?
Amazon CloudWatchMetrics, log storage, metric filters and alarmsHas CPU or error rate spiked? Did a log line match a pattern?
Amazon GuardDutyManaged threat detection using CloudTrail, VPC Flow Logs, DNS logs and moreIs an instance talking to a known crypto-mining pool?
AWS ConfigInventory and change history; rules check complianceWhich buckets are not encrypted? What did this SG look like last week?
AWS Security HubCollects findings and runs security standard checksWhat are my highest-severity issues across accounts?
Amazon DetectiveGraph-based investigation of findingsWhat else did this role do around the time of the alert?

CloudTrail keeps 90 days of management events in Event history by default, but for real protection create a trail (an organisation trail in AWS Organizations) that delivers logs to a central S3 bucket in a separate log archive account.

Events worth alerting on

From event to responseAPI calle.g.StopLoggingCloudTrailrecords eventEventBridgematches ruleNotifySNS or ticketRespondLambda oranalyst
Figure 2. A simple detection pipeline: a recorded event matches a rule that alerts people or triggers automation.
  • Any root user sign-in or API call.
  • StopLogging, DeleteTrail or changes to GuardDuty and Config.
  • Console sign-ins without MFA, and repeated failed sign-ins.
  • New IAM users, new access keys or policies granting *:*.
  • Security groups opened to 0.0.0.0/0 on admin ports.
  • Resources launched in regions you do not use.

A baseline for every account

  1. Create an organisation-wide CloudTrail trail with log file validation, delivered to a log archive account.
  2. Protect the log bucket with Object Lock or tight policies, and encrypt with KMS.
  3. Enable GuardDuty in all accounts and regions with a delegated administrator.
  4. Enable AWS Config recording and Security Hub with a standard such as AWS Foundational Security Best Practices or the CIS AWS Foundations Benchmark.
  5. Turn on VPC Flow Logs for important networks.
  6. Send high-severity findings to your ticketing system or a SIEM, and write a short runbook for each.

Tip: detection only works if someone reacts. Start with a handful of high-value alerts that always get a response, rather than hundreds that everyone ignores.

Practice

Which service would show who changed a security group yesterday?
AWS CloudTrail, which records the API call, the identity, time and source IP. AWS Config also shows the before and after configuration.
Why store CloudTrail logs in a separate account?
So an attacker who compromises a workload account cannot delete or alter the evidence.
GuardDuty reports an instance querying a crypto-mining domain. What are sensible first steps?
Confirm the finding, isolate the instance by changing its security group, snapshot it for forensics, and check how it was compromised.

Key takeaways

  • CloudTrail records API activity; protect it in a separate log account.
  • CloudWatch handles metrics, logs and alarms.
  • GuardDuty detects threats; Config tracks changes; Security Hub centralises findings.
  • Alert on root use, logging changes, new keys and open admin ports.
  • Enable everything in every account and region you use.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.