원클릭으로
cloudwatch
Monitor AWS resources with CloudWatch — query logs, metrics, and alarms, create dashboards, and set up alerting via AWS CLI.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Monitor AWS resources with CloudWatch — query logs, metrics, and alarms, create dashboards, and set up alerting via AWS CLI.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | cloudwatch |
| description | Monitor AWS resources with CloudWatch — query logs, metrics, and alarms, create dashboards, and set up alerting via AWS CLI. |
| metadata | {"openclaw":{"emoji":"📊","requires":{"bins":["aws"]}}} |
Use this skill for observability operations: tailing and querying logs, checking metrics, managing alarms, and creating dashboards.
cloudwatch:*, logs:* for full access# List log groups
aws logs describe-log-groups \
--query 'logGroups[].[logGroupName, storedBytes, retentionInDays]' \
--output table
# Tail logs in real-time (most useful for debugging)
aws logs tail <log-group-name> --follow --since 10m
# Tail with a filter
aws logs tail <log-group-name> --follow --since 5m --filter-pattern "ERROR"
# Search logs with filter pattern
aws logs filter-log-events \
--log-group-name <log-group-name> \
--filter-pattern "ERROR" \
--start-time $(date -d '1 hour ago' +%s)000 \
--query 'events[].[timestamp, message]' \
--output text
# Run a Logs Insights query
aws logs start-query \
--log-group-name <log-group-name> \
--start-time $(date -d '1 hour ago' +%s) \
--end-time $(date +%s) \
--query-string 'fields @timestamp, @message | filter @message like /ERROR/ | sort @timestamp desc | limit 50'
# Get query results (use the queryId from start-query)
aws logs get-query-results --query-id <query-id>
# List recent log streams
aws logs describe-log-streams \
--log-group-name <log-group-name> \
--order-by LastEventTime --descending --limit 5
# Set retention (save cost on old logs)
aws logs put-retention-policy \
--log-group-name <log-group-name> \
--retention-in-days 30
# List available metrics for a namespace
aws cloudwatch list-metrics --namespace AWS/EC2
# List metrics for a specific instance
aws cloudwatch list-metrics \
--namespace AWS/EC2 \
--dimensions Name=InstanceId,Value=<instance-id>
# Get CPU utilization for an EC2 instance (last 1 hour, 5-min intervals)
aws cloudwatch get-metric-statistics \
--namespace AWS/EC2 \
--metric-name CPUUtilization \
--dimensions Name=InstanceId,Value=<instance-id> \
--start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 300 \
--statistics Average Maximum \
--output table
# Get Lambda invocation errors (last 24 hours)
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda \
--metric-name Errors \
--dimensions Name=FunctionName,Value=<function-name> \
--start-time $(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 3600 \
--statistics Sum \
--output table
# Get RDS connections
aws cloudwatch get-metric-statistics \
--namespace AWS/RDS \
--metric-name DatabaseConnections \
--dimensions Name=DBInstanceIdentifier,Value=<db-id> \
--start-time $(date -u -d '6 hours ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 300 \
--statistics Average Maximum \
--output table
# Get S3 bucket size
aws cloudwatch get-metric-statistics \
--namespace AWS/S3 \
--metric-name BucketSizeBytes \
--dimensions Name=BucketName,Value=<bucket> Name=StorageType,Value=StandardStorage \
--start-time $(date -u -d '2 days ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 86400 \
--statistics Average
# List all alarms
aws cloudwatch describe-alarms \
--query 'MetricAlarms[].[AlarmName, StateValue, MetricName, Namespace]' \
--output table
# List alarms in ALARM state
aws cloudwatch describe-alarms --state-value ALARM \
--query 'MetricAlarms[].[AlarmName, StateReason]' --output table
# Get alarm history
aws cloudwatch describe-alarm-history \
--alarm-name <alarm-name> \
--history-item-type StateUpdate \
--max-items 10
# Create a CPU alarm
aws cloudwatch put-metric-alarm \
--alarm-name high-cpu-<instance-id> \
--alarm-description "CPU > 80% for 5 minutes" \
--namespace AWS/EC2 \
--metric-name CPUUtilization \
--dimensions Name=InstanceId,Value=<instance-id> \
--statistic Average \
--period 300 \
--evaluation-periods 1 \
--threshold 80 \
--comparison-operator GreaterThanThreshold \
--alarm-actions <sns-topic-arn>
# Create a Lambda error alarm
aws cloudwatch put-metric-alarm \
--alarm-name lambda-errors-<function-name> \
--alarm-description "Lambda errors > 5 in 5 minutes" \
--namespace AWS/Lambda \
--metric-name Errors \
--dimensions Name=FunctionName,Value=<function-name> \
--statistic Sum \
--period 300 \
--evaluation-periods 1 \
--threshold 5 \
--comparison-operator GreaterThanThreshold \
--treat-missing-data notBreaching \
--alarm-actions <sns-topic-arn>
# Temporarily suppress an alarm
aws cloudwatch set-alarm-state \
--alarm-name <alarm-name> \
--state-value OK \
--state-reason "Manual reset during maintenance"
🛑 DESTRUCTIVE — Always confirm with the user before executing any of these commands.
# Delete an alarm
aws cloudwatch delete-alarms --alarm-names <alarm-name>
# Delete a log group (ALL logs permanently lost)
aws logs delete-log-group --log-group-name <log-group-name>
--treat-missing-data notBreaching on alarms unless the user specifically wants alerts on missing data.filter-log-events for complex searches — they're faster and more capable.FUNC="my-function"
echo "=== Recent Errors ==="
aws logs tail /aws/lambda/$FUNC --since 30m --filter-pattern "ERROR"
echo "=== Invocation Metrics (last hour) ==="
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda --metric-name Invocations \
--dimensions Name=FunctionName,Value=$FUNC \
--start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 300 --statistics Sum --output table
echo "=== Error Count ==="
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda --metric-name Errors \
--dimensions Name=FunctionName,Value=$FUNC \
--start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 300 --statistics Sum --output table
aws logs describe-log-groups \
--query 'logGroups[?!retentionInDays].[logGroupName, storedBytes]' \
--output table
QUERY_ID=$(aws logs start-query \
--log-group-name <log-group-name> \
--start-time $(date -d '1 hour ago' +%s) \
--end-time $(date +%s) \
--query-string 'filter @message like /ERROR/ | stats count(*) as errorCount by @message | sort errorCount desc | limit 10' \
--query 'queryId' --output text)
sleep 5
aws logs get-query-results --query-id $QUERY_ID
| Error | Cause | Fix |
|---|---|---|
ResourceNotFoundException | Log group doesn't exist | Check the log group name and region |
LimitExceededException | Too many concurrent Insights queries | Wait and retry — limit is 30 concurrent queries |
| No data points returned | Wrong time range or dimensions | Verify the namespace, metric name, and dimension values |
Alarm stuck in INSUFFICIENT_DATA | Metric not being emitted | Check that the resource exists and is active |
ThrottlingException | Too many API calls | Add delays between calls or reduce polling frequency |
Manage AWS Certificate Manager certificates, validation, renewal, and import for ALB, CloudFront, and API Gateway via AWS CLI.
Manage Amazon API Gateway REST APIs, HTTP APIs, WebSocket APIs, stages, and deployments via AWS CLI.
Manage EC2 Auto Scaling groups, launch templates, scaling policies, and scheduled actions via AWS CLI.
Manage Elastic Load Balancers (ALB, NLB, CLB), target groups, listeners, and health checks via AWS CLI.
Manage AWS Organizations accounts, OUs, SCPs, and delegated administration via AWS CLI.
Manage Amazon SageMaker notebooks, training jobs, models, endpoints, and pipelines via AWS CLI.