itsmostafa/aws-agent-skills/cloudwatch
- community
Checking that the SKILL.md file is still in the repository.
AWS CloudWatch monitoring for logs, metrics, alarms, and dashboards. Use when setting up monitoring, creating alarms, querying logs with Insights, configuring metric filters, building dashboards, or troubleshooting application issues.
Install
npx vskill@latest install itsmostafa/aws-agent-skills/cloudwatchSKILL.md
AWS CloudWatch
Amazon CloudWatch provides monitoring and observability for AWS resources and applications. It collects metrics, logs, and events, enabling you to monitor, troubleshoot, and optimize your AWS environment.
Table of Contents
Core Concepts
Metrics
Time-ordered data points published to CloudWatch. Key components:
- Namespace: Container for metrics (e.g.,
AWS/Lambda) - Metric name: Name of the measurement (e.g.,
Invocations) - Dimensions: Name-value pairs for filtering (e.g.,
FunctionName=MyFunc) - Statistics: Aggregations (Sum, Average, Min, Max, SampleCount, pN)
Logs
Log data from AWS services and applications:
- Log groups: Collections of log streams
- Log streams: Sequences of log events from same source
- Log events: Individual log entries with timestamp and message
Alarms
Automated actions based on metric thresholds:
- States: OK, ALARM, INSUFFICIENT_DATA
- Actions: SNS notifications, Lambda functions, Auto Scaling, EC2 actions, Systems Manager OpsItems
- Types: metric (incl. metric math, anomaly detection, Metrics Insights), composite, log (scheduled Logs Insights query evaluated M-out-of-N on query results)
- Mute rules: scheduled windows that mute actions while alarms keep evaluating
Common Patterns
Create a Metric Alarm
AWS CLI:
boto3:
Lambda Error Rate Alarm
Query Logs with Insights
boto3:
Create Metric Filter
Extract metrics from log patterns:
Create a Log Alarm
Alarm directly on a Logs Insights query (no metric filter needed). CloudWatch creates and manages the underlying scheduled query. The ScheduledQueryRoleARN role must trust logs.amazonaws.com and allow logs:StartQuery and logs:GetQueryResults on the log group ARNs, plus logs:StopQuery and logs:DescribeLogGroups on "Resource": "*" (these two support no resource-level permissions, so a log-group-scoped statement never matches them).
Publish Custom Metrics
Create Dashboard
CLI Reference
Metrics Commands
| Command | Description | |
|---|---|---|
aws cloudwatch put-metric-data | Publish custom metrics | |
aws cloudwatch get-metric-data | Retrieve metric values | |
aws cloudwatch get-metric-statistics | Get aggregated statistics | |
aws cloudwatch list-metrics | List available metrics |
Alarms Commands
| Command | Description | |
|---|---|---|
aws cloudwatch put-metric-alarm | Create or update alarm | |
aws cloudwatch put-log-alarm | Create or update log query alarm | |
aws cloudwatch describe-alarms | List alarms (--alarm-types LogAlarm for log alarms) | |
aws cloudwatch describe-alarm-contributors | Show breaching contributors of a multi-contributor alarm | |
aws cloudwatch put-alarm-mute-rule | Create or update scheduled mute window | |
aws cloudwatch list-alarm-mute-rules | List mute rules (--statuses SCHEDULED ACTIVE EXPIRED) | |
aws cloudwatch delete-alarm-mute-rule | Delete mute rule (unmutes immediately) | |
aws cloudwatch set-alarm-state | Manually set alarm state | |
aws cloudwatch delete-alarms | Delete alarms |
Logs Commands
| Command | Description | |
|---|---|---|
aws logs create-log-group | Create log group | |
aws logs put-log-events | Write log events | |
aws logs filter-log-events | Search log events | |
aws logs start-query | Start Insights query | |
aws logs put-metric-filter | Create metric filter | |
aws logs put-retention-policy | Set log retention |
Best Practices
Metrics
- Use dimensions wisely — too many creates metric explosion
- Aggregate before publishing — batch custom metrics
- Use high-resolution metrics (1-second) only when needed
- Set meaningful units for custom metrics
Alarms
- Use composite alarms for complex conditions
- Set appropriate evaluation periods to avoid flapping
- Include OK actions to track recovery
- Use anomaly detection for dynamic thresholds
- Use log alarms instead of metric filter + metric alarm for query-based conditions; set
--treat-missing-data notBreachingfor sparse errors,breachingto detect logs that stop arriving - Stagger log alarm schedules — concurrent scheduled query executions per account are capped at 100
- Set `--warm-up-configuration` on alarms created alongside new resources (1-2880 min) to avoid noise before metrics publish
- Use `--evaluation-window WallClockWindow={Timezone=...}` for daily/weekly batch or backup alarms; keep the default sliding window for Auto Scaling
- Use mute rules for maintenance, not
disable-alarm-actions;enable-alarm-actionsdoes not unmute an active mute rule
Logs
- Set retention policies — don't keep logs forever
- Use structured logging (JSON) for better querying
- Create metric filters for key events
- Use Contributor Insights for top-N analysis
Cost Optimization
- Delete unused dashboards
- Reduce log retention for non-critical logs
- Avoid high-resolution metrics unless necessary
- Use log subscription filters instead of polling
Troubleshooting
Missing Metrics
Causes:
- Service not publishing yet (wait 1-5 minutes)
- Wrong namespace/dimensions
- Detailed monitoring not enabled (EC2)
Debug:
Alarm Stuck in INSUFFICIENT_DATA
Causes:
- Metric not being published
- Dimensions mismatch
- Evaluation period too short
- Warm-up period still active (ends early once data fills the window unless
OnlyStartEvaluatingAfterWarmUpPeriodEnds=true) - Log alarm: just created/updated (query, schedule, or log group changes reset state), scheduled query role lacks permissions (
EvaluationState=EVALUATION_ERROR, seeStateReason), or ingestion lag (shift window back withEndTimeOffset)
Debug:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cloudwatch/SKILL.md
Popularity
- Repository stars
- 1,050
- Repository forks
- 437
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/itsmostafa/aws-agent-skills/cloudwatch)