Investigate AWS production incidents with CloudWatch Logs Insights, Metrics, Alarms, CloudTrail correlation, blast-radius narrowing, metric math, and incident timelines. Use when the user asks to debug CloudWatch alarms, query Logs Insights, correlate alarms to deployments, find Lambda cold starts, OOMs, timeouts, throttling, or reconstruct an AWS incident timeline.
Take an AWS incident signal, transform it into scoped CloudWatch Logs, Metrics, Alarm, and CloudTrail evidence, and return a timeline, blast-radius conclusion, likely root event, and next validation steps.
When to invoke
"Investigate this CloudWatch alarm."
"Write Logs Insights queries for this error spike."
"Did a deployment cause this AWS incident?"
"Narrow the blast radius for these Lambda failures."
"Build an incident timeline from CloudWatch and CloudTrail."
Prerequisites and context
The user must provide or authorize access to the AWS account, region, log groups, alarm names, service namespace, and incident window.
Prefer read-only investigation. Do not change alarms, dashboards, retention, Lambda memory, ECS services, or infrastructure unless separately asked.
Use event timestamps, not ingestion timestamps, when comparing CloudWatch Logs, CloudWatch Metrics, CloudWatch Alarms, CloudTrail, and AWS Health.
Use the alarm transition timestamp as the anchor. Query CloudTrail for deployment-related events in [alarm_time - 30min, alarm_time]:
SELECT eventTime, eventName, userIdentity.arn, requestParameters
FROM <event-data-store-id>
WHERE eventTime > '<alarm_time_minus_30m>'
AND eventTime < '<alarm_time>'
AND eventName IN (
'UpdateFunctionCode', 'UpdateFunctionConfiguration',
'UpdateService', 'CreateDeployment', 'RegisterTaskDefinition',
'CreateChangeSet', 'ExecuteChangeSet',
'StartPipelineExecution', 'PutImage'
)
ORDER BY eventTime DESC
Correlation strength
Evidence
Strong
Same service/resource, completed within 15 minutes before alarm, CI/CD actor such as an assumed GitHub Actions deploy role, and alarm was OK in the previous deployment cycle.
Medium
Same account or service but partial resource match, nearby timing, or ambiguous actor.
Weak
Only temporal proximity, human hotfix, missing prior healthy cycle, or simultaneous environmental changes.
Not correlated
No deploy/config/image/change-set event before the first symptom.
Strengthen the correlation by checking canary or synthetic monitor failures, scaling events, config changes, and whether any other environmental change happened in the same window.
Blast-radius decision tree
START
|
v
[1] ACCOUNT — Which account(s) show the alarm?
| - Multi-account: suspect shared service such as SSO, networking, or deployment pipeline
| - Single account: proceed to Region
v
[2] REGION — Which region(s) are affected?
| - Multi-region: suspect global service such as IAM, Route53, or S3 global behavior
| - Single-region: proceed to Service
v
[3] SERVICE — Which service namespace shows degradation?
| - Multiple services: suspect VPC, NAT, DNS, IAM, shared database, cache, or external API
| - Single service: proceed to Operation
v
[4] OPERATION — Which API action, function, stage, resource, method, ECS service, or task definition is failing?
| - All operations: suspect service-level throttling or quota
| - Specific operation: proceed to Resource
v
[5] RESOURCE — Which Function ARN, Task ID, DB instance identifier, or other resource instance is the investigation target?
When multiple services are affected, investigate in this order: VPC/Networking (NAT Gateway ErrorPortAllocation, packet drops, DNS), IAM/STS (ThrottlingException on AssumeRole, token vending latency), downstream dependency, shared deployment pipeline, then AWS Health Dashboard and Service Health.
Replace TARGET, FunctionName, ApiName, and TableName with the scoped resource. Treat 1000 as a default example account concurrency limit; use the account's actual quota when known.
Incident timeline reconstruction
Collect timestamped evidence and sort by event time:
Source
Query or API
Yields
CloudWatch Alarms
Alarm history API
State transition times
CloudWatch Metrics
GetMetricData with 1-minute period
First anomaly datapoint
CloudWatch Logs
Logs Insights with earliest(@timestamp)
First error occurrence
CloudTrail
LookupEvents or CloudTrail Lake
Deployment and configuration events
AWS Health
DescribeEvents
AWS-side incidents
Root event rule: walk backward from the first symptom to the most recent deploy, config change, scaling event, quota pressure, or external dependency shift that can explain all later symptoms.
Gotchas
CloudWatch metric timestamps are end-of-period; a 1-minute datapoint at 14:05 covers 14:04-14:05.
CloudTrail can have up to 15-minute delivery delay; use eventTime, not ingestion time.
Log group timestamps depend on agent or SDK flush interval; allow 30-60 seconds of clock skew.
Alarm state changes include evaluation delay: periods x evaluation periods; the anomaly often started earlier.
Source compatibility terms
Retain these CloudWatch incident terms in investigations and reports: 5/min, ALARM, AWS/ECS, Deployment/change, IAM/STS**, STRONG, StartTime/EndTime, VPC/Networking**, agent/SDK, alarm-to-deployment, assumed-role, assumed-role/github-actions-deploy/session, built-in, canary/synthetic, github-actions-deploy, multi-region, payment-processor, payments-api, service/task, single-region, stage/resource/method, us-east-1, EndTime, MetricName, MetricStat, PaymentProcessorErrors, and StartTime.
Output template
## CloudWatch investigation — <alarm, service, or incident>
**Status:** investigating | likely cause found | inconclusive | blocked
**Window:** <start> to <end> UTC
**Scope:** account=<id>, region=<region>, service=<namespace>, resource=<resource>
### Findings
| Time | Source | Evidence | Interpretation |
| --- | --- | --- | --- |
| `<timestamp>` | CloudTrail | `<eventName by actor>` | `<deploy/config/change candidate>` |
| `<timestamp>` | Logs Insights | `<query result>` | `<first symptom or dominant error>` |
### Blast radius
- Account: <single | multiple>
- Region: <single | multiple>
- Service: <single | multiple>
- Operation/resource: <specific target>
### Correlation
**Deployment correlation:** strong | medium | weak | none
**Root event:** <earliest plausible change or unknown>
**Confidence:** high | medium | low
### Queries used
- `<Logs Insights or MetricDataQueries summary>`
### Next checks
- <one concrete validation or mitigation step>
Quality gate
Alarm transition time, first symptom time, and investigation window are explicit.
Logs, metrics, alarms, CloudTrail, and AWS Health are considered or explicitly marked unavailable.
Blast radius is narrowed in account → region → service → operation → resource order.
Deployment correlation uses same resource, timing, actor, and prior-health evidence.
Metric math names the namespace, metric, dimensions, period, statistic, and expression.
Timeline entries use event timestamps and account for metric period, CloudTrail delay, log skew, and alarm evaluation delay.
1---2name: aws-cloudwatch-investigation3description: Investigate AWS production incidents with CloudWatch Logs Insights, Metrics, Alarms, CloudTrail correlation, blast-radius narrowing, metric math, and incident timelines. Use when the user asks to debug CloudWatch alarms, query Logs Insights, correlate alarms to deployments, find Lambda cold starts, OOMs, timeouts, throttling, or reconstruct an AWS incident timeline.4---56<!-- Generated from harness/github-copilot/skills/aws-cloudwatch-investigation/SKILL.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# AWS CloudWatch investigation910Take an AWS incident signal, transform it into scoped CloudWatch Logs, Metrics, Alarm, and CloudTrail evidence, and return a timeline, blast-radius conclusion, likely root event, and next validation steps.1112## When to invoke1314- "Investigate this CloudWatch alarm."15- "Write Logs Insights queries for this error spike."16- "Did a deployment cause this AWS incident?"17- "Narrow the blast radius for these Lambda failures."18- "Build an incident timeline from CloudWatch and CloudTrail."1920## Prerequisites and context2122- The user must provide or authorize access to the AWS account, region, log groups, alarm names, service namespace, and incident window.23- Prefer read-only investigation. Do not change alarms, dashboards, retention, Lambda memory, ECS services, or infrastructure unless separately asked.24- Use event timestamps, not ingestion timestamps, when comparing CloudWatch Logs, CloudWatch Metrics, CloudWatch Alarms, CloudTrail, and AWS Health.2526## Logs Insights query patterns2728| Situation | Query |29| --- | --- |30| Error spike detection | `fields @timestamp, @message, @logStream\n| filter @message like /(?i)(error|exception|fatal|critical)/\n| stats count(*) as errorCount by bin(5m), @logStream\n| sort errorCount desc\n| limit 20` |31| P99 latency by operation | `fields @timestamp, @duration, operation\n| filter ispresent(@duration)\n| stats avg(@duration) as avgMs, pct(@duration, 50) as p50Ms, pct(@duration, 95) as p95Ms, pct(@duration, 99) as p99Ms, count(*) as invocations by operation\n| sort p99Ms desc\n| limit 15` |32| Lambda cold starts | `fields @timestamp, @duration, @initDuration, @memorySize, @maxMemoryUsed\n| filter ispresent(@initDuration)\n| stats count(*) as coldStarts, avg(@initDuration) as avgInitMs, max(@initDuration) as maxInitMs, avg(@duration) as avgDurationMs by bin(5m)\n| sort @timestamp desc` |33| OOM events | `fields @timestamp, @message, @logStream, @memorySize, @maxMemoryUsed\n| filter @message like /Runtime exited|out of memory|OOMKilled|Cannot allocate memory|MemoryError/\n| stats count(*) as oomEvents by @logStream, bin(10m)\n| sort oomEvents desc\n| limit 10` |34| Memory trend before OOM | `fields @timestamp, @maxMemoryUsed, @memorySize\n| filter ispresent(@maxMemoryUsed)\n| stats max(@maxMemoryUsed / @memorySize * 100) as peakMemPct, avg(@maxMemoryUsed / @memorySize * 100) as avgMemPct by bin(5m)\n| sort @timestamp desc` |35| Timeout detection | `fields @timestamp, @duration, @logStream, @requestId\n| filter @message like /Task timed out/ or @duration > 28000\n| stats count(*) as timeouts by @logStream, bin(5m)\n| sort timeouts desc` |36| First error timeline | `fields @timestamp, @message\n| filter @message like /ERROR|WARN|timeout|refused|denied/\n| stats earliest(@timestamp) as firstSeen, latest(@timestamp) as lastSeen, count(*) as occurrences by @message\n| sort firstSeen asc\n| limit 20` |3738## Deployment correlation3940Use the alarm transition timestamp as the anchor. Query CloudTrail for deployment-related events in `[alarm_time - 30min, alarm_time]`:4142```sql43SELECT eventTime, eventName, userIdentity.arn, requestParameters44FROM <event-data-store-id>45WHERE eventTime > '<alarm_time_minus_30m>'46 AND eventTime < '<alarm_time>'47 AND eventName IN (48 'UpdateFunctionCode', 'UpdateFunctionConfiguration',49 'UpdateService', 'CreateDeployment', 'RegisterTaskDefinition',50 'CreateChangeSet', 'ExecuteChangeSet',51 'StartPipelineExecution', 'PutImage'52 )53ORDER BY eventTime DESC54```5556| Correlation strength | Evidence |57| --- | --- |58| Strong | Same service/resource, completed within 15 minutes before alarm, CI/CD actor such as an assumed GitHub Actions deploy role, and alarm was `OK` in the previous deployment cycle. |59| Medium | Same account or service but partial resource match, nearby timing, or ambiguous actor. |60| Weak | Only temporal proximity, human hotfix, missing prior healthy cycle, or simultaneous environmental changes. |61| Not correlated | No deploy/config/image/change-set event before the first symptom. |6263Strengthen the correlation by checking canary or synthetic monitor failures, scaling events, config changes, and whether any other environmental change happened in the same window.6465## Blast-radius decision tree6667```68START69 |70 v71[1] ACCOUNT — Which account(s) show the alarm?72 | - Multi-account: suspect shared service such as SSO, networking, or deployment pipeline73 | - Single account: proceed to Region74 v75[2] REGION — Which region(s) are affected?76 | - Multi-region: suspect global service such as IAM, Route53, or S3 global behavior77 | - Single-region: proceed to Service78 v79[3] SERVICE — Which service namespace shows degradation?80 | - Multiple services: suspect VPC, NAT, DNS, IAM, shared database, cache, or external API81 | - Single service: proceed to Operation82 v83[4] OPERATION — Which API action, function, stage, resource, method, ECS service, or task definition is failing?84 | - All operations: suspect service-level throttling or quota85 | - Specific operation: proceed to Resource86 v87[5] RESOURCE — Which Function ARN, Task ID, DB instance identifier, or other resource instance is the investigation target?88```8990When multiple services are affected, investigate in this order: VPC/Networking (`NAT Gateway ErrorPortAllocation`, packet drops, DNS), IAM/STS (`ThrottlingException` on `AssumeRole`, token vending latency), downstream dependency, shared deployment pipeline, then AWS Health Dashboard and Service Health.9192## Metric math patterns9394| Signal | MetricDataQueries pattern |95| --- | --- |96| Error rate percentage | `errors = AWS/Lambda Errors Sum`, `invocations = AWS/Lambda Invocations Sum`, `error_rate = errors / invocations * 100`, label `Error Rate %`. |97| Latency anomaly | `current_p99 = AWS/Lambda Duration p99` for current window, `baseline_p99 = AWS/Lambda Duration p99` for same window last week, `anomaly_ratio = current_p99 / baseline_p99`, label `Latency vs Baseline (ratio > 2 = anomaly)`. |98| Throttling pressure | Sum `lambda_throttles`, `api_gw_429s` from `AWS/ApiGateway 4XXError`, and `dynamo_throttles` from `AWS/DynamoDB ThrottledRequests` into `throttle_pressure`. |99| Concurrent execution headroom | `concurrent = AWS/Lambda ConcurrentExecutions Maximum`, `headroom = 1000 - concurrent`, label `Remaining Concurrency (account limit 1000)`. |100101Replace `TARGET`, `FunctionName`, `ApiName`, and `TableName` with the scoped resource. Treat `1000` as a default example account concurrency limit; use the account's actual quota when known.102103## Incident timeline reconstruction104105Collect timestamped evidence and sort by event time:106107| Source | Query or API | Yields |108| --- | --- | --- |109| CloudWatch Alarms | Alarm history API | State transition times |110| CloudWatch Metrics | `GetMetricData` with 1-minute period | First anomaly datapoint |111| CloudWatch Logs | Logs Insights with `earliest(@timestamp)` | First error occurrence |112| CloudTrail | `LookupEvents` or CloudTrail Lake | Deployment and configuration events |113| AWS Health | `DescribeEvents` | AWS-side incidents |114115Root event rule: walk backward from the first symptom to the most recent deploy, config change, scaling event, quota pressure, or external dependency shift that can explain all later symptoms.116117## Gotchas118119- CloudWatch metric timestamps are end-of-period; a 1-minute datapoint at `14:05` covers `14:04-14:05`.120- CloudTrail can have up to 15-minute delivery delay; use `eventTime`, not ingestion time.121- Log group timestamps depend on agent or SDK flush interval; allow 30-60 seconds of clock skew.122- Alarm state changes include evaluation delay: `periods x evaluation periods`; the anomaly often started earlier.123124## Source compatibility terms125126Retain these CloudWatch incident terms in investigations and reports: `5/min`, `ALARM`, `AWS/ECS`, `Deployment/change`, `IAM/STS**`, `STRONG`, `StartTime/EndTime`, `VPC/Networking**`, `agent/SDK`, `alarm-to-deployment`, `assumed-role`, `assumed-role/github-actions-deploy/session`, `built-in`, `canary/synthetic`, `github-actions-deploy`, `multi-region`, `payment-processor`, `payments-api`, `service/task`, `single-region`, `stage/resource/method`, `us-east-1`, `EndTime`, `MetricName`, `MetricStat`, `PaymentProcessorErrors`, and `StartTime`.127128## Output template129130```markdown131## CloudWatch investigation — <alarm, service, or incident>132133**Status:** investigating | likely cause found | inconclusive | blocked134**Window:** <start> to <end> UTC135**Scope:** account=<id>, region=<region>, service=<namespace>, resource=<resource>136137### Findings138| Time | Source | Evidence | Interpretation |139| --- | --- | --- | --- |140| `<timestamp>` | CloudTrail | `<eventName by actor>` | `<deploy/config/change candidate>` |141| `<timestamp>` | Logs Insights | `<query result>` | `<first symptom or dominant error>` |142143### Blast radius144- Account: <single | multiple>145- Region: <single | multiple>146- Service: <single | multiple>147- Operation/resource: <specific target>148149### Correlation150**Deployment correlation:** strong | medium | weak | none151**Root event:** <earliest plausible change or unknown>152**Confidence:** high | medium | low153154### Queries used155- `<Logs Insights or MetricDataQueries summary>`156157### Next checks158- <one concrete validation or mitigation step>159```160161## Quality gate162163- [ ] Alarm transition time, first symptom time, and investigation window are explicit.164- [ ] Logs, metrics, alarms, CloudTrail, and AWS Health are considered or explicitly marked unavailable.165- [ ] Blast radius is narrowed in account → region → service → operation → resource order.166- [ ] Deployment correlation uses same resource, timing, actor, and prior-health evidence.167- [ ] Metric math names the namespace, metric, dimensions, period, statistic, and expression.168- [ ] Timeline entries use event timestamps and account for metric period, CloudTrail delay, log skew, and alarm evaluation delay.
Run npx skillmds@latest add paulasilvatech/aws-cloudwatch-investigation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Investigate AWS production incidents with CloudWatch Logs Insights, Metrics, Alarms, CloudTrail correlation, blast-radius narrowing, metric math, and incident timelines. Use when the user asks to debug CloudWatch alarms, query Logs Insights, correlate alarms to deployments, find Lambda cold starts, OOMs, timeouts, throttling, or reconstruct an AWS incident timeline. It is listed under DevOps & Infra on SkillMD.
SkillMD's automated safety review verdict for this skill is PASS. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
paulasilvatech (@paulasilvatech) published this skill. Their other Agent Skills are listed on their SkillMD profile.