D

AWS CloudWatch

CloudWatch commands for logs, metrics and alarms.

Updated 2026-09-03

On this page

Logs

aws logs describe-log-groups

Lists CloudWatch Logs groups.

aws logs tail /aws/lambda/my-function --follow

Streams a log group live, similar to tail -f.

aws logs filter-log-events --log-group-name /aws/lambda/my-function --filter-pattern "ERROR"

Searches a log group for lines matching a pattern, across a time range.

aws logs get-log-events --log-group-name /aws/ecs/my-service --log-stream-name STREAM_NAME

Fetches events from a specific log stream within a group.

Metrics

aws cloudwatch list-metrics --namespace AWS/EC2

Lists available metrics within a namespace.

aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --dimensions Name=InstanceId,Value=i-0123456789abcdef0 --start-time 2026-09-02T00:00:00Z --end-time 2026-09-03T00:00:00Z --period 300 --statistics Average

Fetches a metric's datapoints over a time range at a given granularity.

aws cloudwatch put-metric-data --namespace MyApp --metric-name QueueDepth --value 42

Publishes a custom application metric to CloudWatch.

Alarms

aws cloudwatch describe-alarms

Lists configured alarms and their current state (OK, ALARM, INSUFFICIENT_DATA).

aws cloudwatch describe-alarms --state-value ALARM

Lists only alarms currently in the ALARM state — the fast way to see what's actively firing.

aws cloudwatch set-alarm-state --alarm-name high-cpu --state-value OK --state-reason 'manual override'

Manually overrides an alarm's state — useful for testing an alarm's downstream actions without waiting for a real threshold breach.

CloudWatch vs. Prometheus

CloudWatch is AWS's native, zero-setup metrics store with tight service integration — every managed AWS resource publishes to it automatically. Prometheus is pull-based and self-hosted (or managed via AMP), with a richer query language and no per-metric cost — a common pattern is CloudWatch for AWS-managed resources and Prometheus for application-level metrics inside Kubernetes.

Official documentation