6.3 CloudWatch, CloudTrail, and AWS Config

Key Takeaways

  • CloudWatch monitors performance metrics, collects logs, sets alarms, and triggers automated actions — it is the primary monitoring service for AWS resources.
  • CloudTrail records all API calls made in your AWS account — it is the audit trail for WHO did WHAT and WHEN.
  • AWS Config records configuration changes over time and evaluates resource configurations against desired rules for compliance.
  • CloudWatch = performance monitoring (metrics, logs, alarms). CloudTrail = API audit (who/what/when). Config = configuration compliance (desired state vs. actual state).
  • CloudWatch Alarms can trigger Auto Scaling, SNS notifications, EC2 actions (stop, reboot, terminate), and Lambda functions.
Last updated: March 2026

CloudWatch, CloudTrail, and AWS Config

Quick Answer: CloudWatch = metrics + logs + alarms (how are resources performing?). CloudTrail = API call logging (who did what?). AWS Config = configuration history + compliance rules (is this configured correctly?). Use all three together for complete monitoring and governance.

Amazon CloudWatch

CloudWatch is the primary monitoring and observability service for AWS resources.

CloudWatch Components

ComponentDescription
MetricsTime-series data points (CPU utilization, network bytes, custom metrics)
LogsCollect, store, and analyze log files from AWS services and applications
AlarmsWatch a metric and trigger actions when threshold is breached
DashboardsVisual display of metrics and logs
Events/EventBridgeRespond to state changes (now part of EventBridge)
InsightsContainer Insights, Lambda Insights, Application Insights
SyntheticsCanary scripts to monitor API endpoints and URLs
Contributor InsightsIdentify top-N contributors to metric changes

Key Metrics

ServiceDefault MetricsCustom Metrics (require agent)
EC2CPU, Network, Disk I/O, Status ChecksMemory utilization, disk space
RDSCPU, memory, connections, IOPS, storageN/A (AWS provides comprehensive metrics)
LambdaInvocations, duration, errors, throttlesCustom (published via SDK)
ALBRequest count, latency, 4xx/5xx errorsN/A

Important: EC2 memory utilization is NOT a default CloudWatch metric. You must install the CloudWatch Agent to collect memory and disk-level metrics.

CloudWatch Alarms

StateMeaning
OKMetric is within the defined threshold
ALARMMetric has exceeded the threshold
INSUFFICIENT_DATANot enough data to determine state

Alarm Actions:

  • Send SNS notification (email, SMS, Lambda)
  • Auto Scaling action (add/remove instances)
  • EC2 action (stop, terminate, reboot, recover)

CloudWatch Logs

FeatureDescription
Log GroupsCollection of log streams with shared settings
Log StreamsSequence of events from the same source
Retention1 day to 10 years, or never expire
Metric FiltersExtract metrics from log patterns (e.g., count ERROR occurrences)
Subscription FiltersStream logs to Lambda, Kinesis, or OpenSearch in real time
Log InsightsQuery logs with SQL-like syntax
Cross-accountCentralize logs from multiple accounts

AWS CloudTrail

CloudTrail records API calls and actions made in your AWS account.

FeatureDescription
What it logsEvery API call: who, what, when, where, how
DefaultEnabled by default (90 days of management events)
TrailConfigure to deliver logs to S3 for long-term storage
Event typesManagement events (free), Data events (charged), Insights events
Multi-RegionA trail can capture events from all Regions
Organization trailSingle trail for all accounts in an organization
IntegrityLog file validation detects tampering

CloudTrail Event Types

TypeExamplesCost
Management EventsCreate/delete/modify resources, console sign-inFree (90-day history)
Data EventsS3 object-level operations, Lambda invocationsCharged per event
Insights EventsUnusual API activity patternsCharged

AWS Config

AWS Config records configuration changes and evaluates compliance.

FeatureDescription
Configuration recordingRecords changes to resource configurations over time
Config RulesEvaluate whether configurations comply with desired settings
Compliance dashboardVisual status of compliant vs. non-compliant resources
RemediationAutomatically fix non-compliant resources via SSM Automation
AggregatorMulti-account, multi-Region compliance view
TimelineView configuration history for any resource

Config Rule Examples

RuleWhat It Checks
s3-bucket-versioning-enabledS3 buckets have versioning enabled
ec2-instance-no-public-ipEC2 instances do not have public IPs
rds-instance-public-access-checkRDS instances are not publicly accessible
encrypted-volumesEBS volumes are encrypted
iam-root-access-key-checkRoot account has no access keys

Three Pillars Comparison

FeatureCloudWatchCloudTrailAWS Config
FocusPerformance metrics and logsAPI call audit trailConfiguration compliance
Question answered"How is it performing?""Who did what?""Is it configured correctly?"
DataMetrics, logs, alarmsAPI call recordsConfiguration snapshots/changes
Use caseMonitor CPU, set alarmsInvestigate security incidentsEnforce compliance rules

On the Exam: "Who terminated the EC2 instance last night?" → CloudTrail. "Is EC2 CPU above 80%?" → CloudWatch. "Are all S3 buckets encrypted?" → AWS Config.

Test Your Knowledge

A security team needs to investigate who deleted an S3 bucket last Tuesday. Which service provides this information?

A
B
C
D
Test Your Knowledge

A company needs to ensure all EBS volumes are encrypted and automatically remediate non-compliant volumes. Which service should they use?

A
B
C
D
Test Your Knowledge

An EC2 instance is experiencing high CPU utilization. Which service provides this metric by default?

A
B
C
D