AGENT SKILL

ec2-instance-recovery-operator

Operates EC2 instance recovery — system status check failure (hardware degradation, stop/start, EC2 recover action), CloudWatch alarm recovery (reboots on same host), instance replacement via Auto Scaling group health check, EBS volume detach/attach for data salvage, console output for OS-level diagnosis, SSM Session Manager for SSH-less live troubleshooting, AMI creation from a failing instance for forensic snapshot, instance stop/start to clear ephemeral issues, placement group recovery, EC2 automatic recovery, and Capacity Reservation preservation during recovery. Runs deterministic pre-checks (instance state, system status check, EBS attachment status, ASG membership, SSM agent reachability, CloudWatch alarm config, Capacity Reservation binding) behind a CONFIRM gate and emits a READY, BLOCKED, or COMPLETED verdict per recovery action. Use when an instance is impaired, hardware has degraded, an ASG is churning, or a forensic snapshot is needed before termination.

License 许可
Apache-2.0
最近更新
2026-09-24
Stars
★ 4
Forks
0

01 前言 Front Matter

name
ec2-instance-recovery-operator
license
Apache-2.0
metadata
{ "tags": "aws, ec2, compute, recovery, ebs, ssm, cloudwatch, autoscaling, forensics, operate", "phase": "4", "author": "Jacky Chan — AWS Community Builder", "domain": "aws-cloudops", "family": "Compute", "version": "0.1.0", "keywords": "EC2 instance recovery, system status check, instance status check, hardware degradation, stop/start instance, EC2 recover action, CloudWatch alarm recovery, Auto Scaling group replacement, ASG health check, EBS detach attach, console output, get-console-output, SSM Session Manager, AMI forensic snapshot, placement group recovery, Capacity Reservation, instance store, ephemeral storage, impaired instance, EC2 automatic recovery", "task_type": "operate", "complexity": "high", "entry_point": "false", "skill_class": "capability", "when_to_use": "Recovering from an EC2 system status check failure (hardware degradation), configuring CloudWatch alarm recovery, replacing an instance via Auto Scaling group health check, detaching and reattaching EBS volumes to salvage data from an unhealthy instance, diagnosing OS-level issues via console output, accessing an impaired instance via SSM Session Manager, creating an AMI for forensic snapshot before termination, stop/starting an instance to clear ephemeral issues, recovering an instance in a placement group, or preserving a Capacity Reservation binding during recovery.", "requires_llm": "true", "verdict_shape": "READY | BLOCKED | COMPLETED", "lifecycle_status": "active", "invocation_schema": "Input: either (a) an instance configuration (describe-instance-status, describe-instances) plus the intended operation (recover-instance, stop-start, reboot, replace-via-asg, detach-attach-ebs, forensic-ami, enable-recovery-alarm, diagnose-impaired), OR (b) an instance-id + operation for live-account execution. Output: deterministic OPERATION / VERDICT / PRE_CHECKS / STEPS / POST_VERIFY / NOTES block per recovery, where VERDICT is one of READY, BLOCKED, COMPLETED.", "supports_pipeline": "true", "activation_triggers": "instance status check failed, system status check failed, instance impaired, hardware degradation, EC2 recover, CloudWatch recovery alarm, instance stop start, reboot instance, ASG instance replacement, Auto Scaling health check, EBS detach attach, console output, Session Manager access, AMI forensic snapshot, placement group recovery, Capacity Reservation, instance unreachable, EC2 automatic recovery" }
description
Operates EC2 instance recovery — system status check failure (hardware degradation, stop/start, EC2 recover action), CloudWatch alarm recovery (reboots on same host), instance replacement via Auto Scaling group health check, EBS volume detach/attach for data salvage, console output for OS-level diagnosis, SSM Session Manager for SSH-less live troubleshooting, AMI creation from a failing instance for forensic snapshot, instance stop/start to clear ephemeral issues, placement group recovery, EC2 automatic recovery, and Capacity Reservation preservation during recovery. Runs deterministic pre-checks (instance state, system status check, EBS attachment status, ASG membership, SSM agent reachability, CloudWatch alarm config, Capacity Reservation binding) behind a CONFIRM gate and emits a READY, BLOCKED, or COMPLETED verdict per recovery action. Use when an instance is impaired, hardware has degraded, an ASG is churning, or a forensic snapshot is needed before termination.
compatibility
Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline plan classification. Live-account operations use aws ec2 describe-instance-status, describe-instances, stop-instances, start-instances, reboot-instances, describe-volumes, detach-volume, attach-volume, get-console-output, create-image, describe-instance-attribute, aws ssm start-session, describe-instance-information, aws cloudwatch describe-alarms, put-metric-alarm, and...

02 资源文件 21

03 SKILL.md 正文

EC2 Instance Recovery Operator

What this skill does

Executes EC2 instance recovery operations correctly and safely. Runs deterministic pre-checks before any state-changing CLI (instance state, system/instance status checks, EBS attachment status, ASG membership, SSM agent reachability, CloudWatch alarm config, Capacity Reservation binding, placement group state, instance-store warning), executes the recovery behind a CONFIRM gate, and verifies the result by confirming the instance returns to running with both status checks ok. Every recover-instance surfaces the failure-mode table so the operator knows whether to stop/start, reboot, replace via ASG, or escalate to AWS Support. Every forensic-ami captures the snapshot BEFORE the instance is terminated or replaced.

Quick navigation

Section What it covers When to read it
§ Quick reference Verdict thresholds (BLOCKED/READY/COMPLETED) + pre-check priority Before any operation
§ Mindset Why recovery is a state-preserve-then-restore sequence, the instance-store trap Understanding the safety model
§ Pre-flight Instance metadata gate — state, status checks, ASG, Capacity Reservation Before executing any CLI
§ Process Per-operation planning: recover-instance, stop-start, reboot, replace-via-asg, detach-attach-ebs, forensic-ami, enable-recovery-alarm, diagnose-impaired When choosing which operation to run
§ Output format STRICT output contract — OPERATION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY/NOTES template Formatting the response
§ Anti-Patterns NEVER list — common mistakes that lose data or extend downtime Review before risky operations
§ Pre-flight safety Capture pre-state, AMI snapshot, EBS volume IDs, ASG suspend processes Defense-in-depth
§ Expert heuristic Stop/start relocates to new hardware; reboot stays on the same host Choosing stop/start vs reboot

STRICT output contract

EVERY response MUST end with a single fenced text block in this exact shape (the operator's downstream tooling greps for it). No deviations:

OPERATION: <recover-instance | stop-start | reboot | replace-via-asg | detach-attach-ebs | forensic-ami | enable-recovery-alarm | diagnose-impaired>
VERDICT: READY | BLOCKED | COMPLETED
TARGET: <instance-id> (state: <state>, system-status: <status>, instance-status: <status>)
PRE_CHECKS:
  - [PASS] <check description>
  - [FAIL] <check description> — <reason>
STEPS:
  1. <CLI command with flags populated, or "(none — pre-checks failed)">
  2. <wait / monitoring command>
POST_VERIFY:
  - [PASS] <verification description> | (pending execution)
  - [FAIL] <verification description> — <reason>
NOTES: <data-preservation, monitoring, caveats>

Rules of the contract:

  • VERDICT is exactly one of READY, BLOCKED, COMPLETED. No other values. READY means pre-checks passed and a CONFIRM gate is pending; BLOCKED means at least one pre-check failed — do NOT emit STEPS that mutate state; COMPLETED means post-verification passed after the recovery action.
  • If PRE_CHECKS has any [FAIL], VERDICT MUST be BLOCKED and STEPS MUST be (none — pre-checks failed).
  • If VERDICT is READY, STEPS[1] MUST be the CONFIRM prompt and STEPS[2] MUST be the actual CLI.
  • If VERDICT is COMPLETED, POST_VERIFY MUST contain at least one [PASS] and no [FAIL].
  • Never wrap the block in JSON, never abbreviate the field names, never omit a section. If a section is empty, write (none).

Quick reference — verdict thresholds

Verdict Trigger condition Action
BLOCKED One or more pre-checks failed (instance in terminated state, instance-store volumes will be lost on stop/start, ASG will immediately replace before recovery completes, Capacity Reservation binding lost on stop, CloudWatch recovery alarm already configured and firing, SSM agent offline for session access) List failures, do NOT execute
READY All pre-checks passed; awaiting CONFIRM gate Emit exact CLI sequence, wait for operator yes
COMPLETED Recovery finished AND post-verification passed (instance running, both status checks ok, application healthy, EBS volumes reattached if detach/attach) Emit verification results, monitoring plan

Priority order for pre-checks (apply in this sequence, all must pass for READY):

  1. Instance reachability. Instance exists and is NOT in terminated state. shutting-down waits; stopped requires start only.
  2. Status check classification. SystemStatus impaired → hardware/host issue, recover via stop/start or CloudWatch recover. InstanceStatus impaired → OS/application issue, recover via reboot or SSM access.
  3. Instance-store warning. If RootDeviceType: instance-store OR any block device mapping has Ebs: No, stop/start and recover LOSE ephemeral data. BLOCK unless the operator acknowledges.
  4. ASG membership. If the instance is in an ASG, stop/start may trigger a health-check replacement. Suspend HealthCheck / AlarmNotification processes before stopping, or use the ASG's managed replacement flow.
  5. EBS attachment. Capture all volume IDs and attachment state before any recovery. If the instance is unreachable but EBS is healthy, detach + attach to a recovery instance is the safest data-salvage path.
  6. Capacity Reservation binding. If the instance has a Capacity Reservation target, stop/start may release the binding. Use describe-instance-attribute --attribute capacity-reservation-target, and explicitly re-target on start.
  7. Placement group. Stop/start on a cluster placement group instance may fail to restart if the group lacks capacity. Consider reboot (same host) for placement-group recovery.
  8. SSM agent reachability (for session access). describe-instance- information shows PingStatus: Online for SSM-managed instances. Offline SSM means Session Manager will not work; fall back to EC2 Serial Console or console output.
  9. CloudWatch recovery alarm. If a recovery alarm is already configured and the instance is in running after a recover action, the alarm may have already fired — do NOT double-recover.

Cost/time baselines (2026):

  • Stop/start: 2-5 minutes total (stop ~30s, start ~60s, boot varies).
  • Reboot: 1-3 minutes (stays on same host, faster than stop/start).
  • CloudWatch EC2 recover action: 1-5 minutes from alarm breach to recover (same-host reboot, preserves EBS and instance store).
  • ASG replacement: 3-10 minutes (launch + boot + health check + ELB).
  • EBS detach/attach: 30-60 seconds per volume (same AZ only).
  • AMI creation for forensic snapshot: 5-30 minutes depending on EBS size (AMI + snapshots are async).

Mindset

One-line takeaway: Status: running is a process claim, not a health claim. An instance is only "recovered" when both status checks return ok AND the application responds to its health check. Driven by three EC2 realities:

  • Stop/start is destructive for instance-store volumes. Stop releases the host; start lands on a different physical machine. Any data on instance-store volumes is gone. EBS-backed volumes persist. Many operators learn this only after the first recovery.
  • ASG-managed instances have their own recovery loop. When a health check fails, the ASG marks the instance Unhealthy and launches a replacement. Stopping manually without suspending HealthCheck causes the ASG to terminate it. Always check ASG membership before manual recovery.
  • The CloudWatch EC2 recover action is a same-host reboot, NOT a stop/start. It preserves the host, EBS, and instance-store data, but only fixes hardware issues detectable by the status check.

Pre-flight: instance metadata gate

Run before classification. Misclassifying these produces wrong plans.

Pagination: describe-instance-status paginates at 1,000 instances per call; drain --next-token for fleet-wide audits. For a single instance, --instance-ids <id> returns one result.

Live-account pre-flight (skip if offline plan audit): the 7 read-only commands (describe-instance-status ... get-console-output) are listed in Diagnostic commands.

Malformed-input protocol (VERDICT: ERROR + REMEDIATION): see Error handling.

Instance attribute Effect on operation
State: terminated BLOCKED. Route to EBS-based recovery (launch from snapshot/AMI).
State: shutting-down Wait. Poll every 30s until stopped or terminated.
SystemStatus: impaired Hardware/host. Stop/start relocates; recover reboots same host.
InstanceStatus: impaired OS/app. Reboot or SSM session. Stop/start rarely helps.
Events: instance-stop (scheduled) AWS will stop on scheduled date. Plan recovery before window.
Events: system-reboot (scheduled) AWS will reboot. Do NOT manually reboot.
RootDeviceType: instance-store Stop/start LOSES root volume. BLOCK unless acknowledged.
ASG HealthStatus: Unhealthy ASG will terminate+replace. Suspend HealthCheck first.
CapacityReservationId set Stop may release binding. Re-target on start.
Placement.GroupName set (cluster) Stop/start may fail restart. Prefer reboot.
Placement.Tenancy: host Stop releases dedicated host. Verify availability.
Existing recovery alarm Alarm may have fired. Check history; do NOT double-recover.

Process — operation planning (apply in order)

Step 0: Expert knowledge - non-obvious EC2 recovery behaviors (condensed)

  • Stop/start RELOCATES to a new host (loses instance-store data, releases Capacity Reservation/dedicated host). Reboot STAYS on the same host.
  • CloudWatch EC2 recover action = API-driven same-host reboot; only helps StatusCheckFailed_System.
  • ASG-managed replacement usually beats manual recovery; suspend HealthCheck if manual recovery is required.
  • EBS detach/attach to a rescue instance in the same AZ is the safest data-salvage path.
  • create-image --no-reboot for forensic snapshots of hung instances; get-console-output shows the LAST boot only.
  • Full deep dives (Serial Console, automatic recovery, placement groups, metric separation): Advanced patterns.

Step 1: Pre-check gate — BLOCKED if any check fails

Run ALL pre-checks for the chosen operation. If ANY fails, the verdict is BLOCKED with the failed checks in PRE_CHECKS. Do NOT execute.

For ALL operations:

  1. Instance exists and is NOT terminated.
  2. If State: shutting-down, BLOCK (wait for transition).
  3. Capture all EBS volume IDs (for rollback).
  4. Capture RootDeviceType (instance-store warning).
  5. Capture ASG membership (suspend processes if applicable).

For recover-instance (CloudWatch recover action): 6. SystemStatus: impaired (recover only helps hardware). 7. No existing recovery alarm already firing (check alarm history). 8. No scheduled instance-stop event pending (let AWS handle it).

For stop-start (relocate to new host): 6. RootDeviceType: ebs (instance-store loses data). 7. No instance-store block devices (or operator acknowledged). 8. ASG HealthCheck suspended (if applicable). 9. Capacity Reservation target captured for re-binding. 10. Placement group has free capacity for restart (cluster groups).

For reboot (same host): 6. No pending system-reboot scheduled event (let AWS handle it). 7. Instance is running (reboot on stopped is a no-op).

For replace-via-asg: 6. Instance is in an ASG. 7. ASG HealthCheck process is Resumed (not suspended). 8. ASG MinSize >= 1 (so the replacement launches). 9. ELB/target group health check configured (so the new instance registers).

For detach-attach-ebs (data salvage): 6. Rescue instance exists in the same AZ. 7. EBS volume is in-use (attached to the unhealthy instance). 8. DeleteOnTermination: false for the volume (otherwise the source instance's termination deletes it). 9. Rescue instance has the volume slot free (no name conflict on the device name).

For forensic-ami (snapshot before termination): 6. Instance is NOT terminated (AMI cannot capture a terminated instance). 7. EBS-backed root volume (instance-store root cannot be snapshotted). 8. AMI name does not collide with an existing AMI.

For enable-recovery-alarm: 6. No existing recovery alarm on the same metric (avoid duplicate actions). 7. InstanceType supports the EC2 recover action (all current-gen types; some previous-gen types do not). 8. InstanceStatus: ok (do not set a recovery alarm during a known OS issue — the alarm fires on StatusCheckFailed_System only, but verify the operator understands this).

For diagnose-impaired (read-only, no BLOCKED gate): 6. Read the failure-mode table and console output to identify the root cause.

Failure-mode table (use during diagnose-impaired):

Symptom Root cause Fix
SystemStatus: impaired, InstanceStatus: ok Host hardware degradation Stop/start OR CloudWatch recover
InstanceStatus: impaired, SystemStatus: ok OS / filesystem / kernel hang Reboot; if unreachable, SSM or Serial Console
Both impaired Network / VPC / ENI reachability loss Check route table, ENI; stop/start if ENI re-attach needed
State: running, no SSH, SSM Online Security group / IAM role issue SSM Session Manager; verify SG ingress + SSM role
State: running, no SSH, SSM ConnectionLost SSM agent hung or OS network down Reboot; if persistent, EBS detach/attach for repair
Console: kernel panic Kernel module or boot config Stop/start; if persistent, EBS detach/attach to revert module
Console: No space left on device Disk full SSM session to clean up; or expand EBS volume
Console: Failed to mount root filesystem Corrupted root EBS Detach root, attach to rescue, fsck, reattach
ASG churn (rapid launch/terminate) Launch config / AMI / health check Diagnose via ASG activity; freeze ASG to stop churn
State: stopped immediately after launch User-data script failure Check console output; fix user-data; restart

Step 2: READY — emit operation plan

If all pre-checks pass, emit VERDICT: READY with the exact CLI sequence and the CONFIRM gate. The plan includes:

  • The exact AWS CLI command with all flags populated from the instance metadata.
  • The expected duration (stop/start 2-5 min; reboot 1-3 min; AMI 5-30 min depending on EBS size).
  • The expected side-effects (instance-store data lost on stop/start; Capacity Reservation binding released; ASG health-check paused).
  • The CONFIRM gate prompt.
  • The monitoring commands (poll describe-instance-status, check application health endpoint).

Step 3: Execute behind CONFIRM gate

  • MANDATORY CONFIRMATION GATE. Before stop-instances, start-instances, reboot-instances, detach-volume, attach-volume, create-image, terminate-instances, cloudwatch put-metric-alarm, autoscaling suspend-processes / resume-processes, emit: CONFIRM: About to <operation> on <instance-id> in account <account> region <region>. This will <consequence>. Proceed? (yes/no). Do NOT execute until the operator confirms.
  • Capture pre-state: aws ec2 describe-instances --instance-ids <id> --output json > /tmp/<id>-pre-$(date +%s).json AND aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=<id> --output json > /tmp/<id>-volumes-$(date +%s).json.
  • For forensic-ami: ALWAYS run AMI creation BEFORE any stop/start or terminate. The AMI is the point-in-time snapshot.
  • For stop/start: poll describe-instance-status every 30 seconds until State: running and both status checks return ok.

Step 4: Post-verification — COMPLETED

After the recovery finishes, run post-verification. ALL checks must pass for COMPLETED.

  1. describe-instance-status --instance-ids <id> — confirm State: running, SystemStatus.Status: ok, InstanceStatus.Status: ok.
  2. No scheduled Events pending (or, if scheduled, surface them).
  3. For stop-start: confirm EBS volumes reattached and DeleteOn- Termination preserved.
  4. For stop-start with Capacity Reservation: confirm binding re- established (describe-instances --query Reservations[0].Instances [0].CapacityReservationId).
  5. For ASG replacement: confirm the new instance is InService and passes the ELB / target group health check.
  6. For EBS detach/attach: confirm the volume is in-use on the target instance at the expected device name.
  7. For forensic-ami: confirm the AMI is available and all snapshots are completed.
  8. Application health: hit the instance's health-check endpoint or CloudWatch metric; confirm the workload recovered.

If ANY verification fails, emit VERDICT: ERROR with the failure details — do not claim COMPLETED.

Output format (per operation)

See § STRICT output contract above. The block MUST appear exactly in that shape at the end of the response.

Worked example — recover-instance (stop/start)

OPERATION: stop-start
VERDICT: READY
TARGET: i-0abcdef1234567890 (state: running, system-status: impaired,
        instance-status: ok)
PRE_CHECKS:
  - [PASS] Instance exists, not terminated
  - [PASS] SystemStatus impaired (host issue), InstanceStatus ok
  - [PASS] RootDeviceType: ebs (no data loss on stop)
  - [PASS] No instance-store block devices
  - [PASS] ASG: not a member (no suspend needed)
  - [PASS] Capacity Reservation: not bound
  - [PASS] Placement: default (no cluster constraint)
STEPS:
  1. CONFIRM: About to stop and start i-0abcdef1234567890 in account
     111111111111 region us-east-1. This will RELOCATE to a new host
     (clears hardware impairment), cause 2-5 min downtime, preserve
     EBS. Proceed? (yes/no)
  2. aws ec2 stop-instances --instance-ids i-0abcdef1234567890
  3. Poll describe-instance-status every 30s until stopped
  4. aws ec2 start-instances --instance-ids i-0abcdef1234567890
  5. Poll describe-instance-status every 30s until running + ok
POST_VERIFY:
  - (pending execution)
NOTES:
  - Stop/start is correct for SystemStatus impaired. Reboot would
    keep the instance on the same impaired host.
  - Set up a CloudWatch recovery alarm for auto-recovery:
    aws cloudwatch put-metric-alarm --alarm-name recover-i-0abcdef
      --metric-name StatusCheckFailed_System --namespace AWS/EC2
      --dimensions Name=InstanceId,Value=i-0abcdef1234567890
      --threshold 1 --comparison-operator GreaterThanOrEqualToThreshold
      --period 60 --evaluation-periods 2
      --alarm-actions arn:aws:automate:us-east-1:ec2:recover

Anti-Patterns — NEVER

  • NEVER stop an instance with RootDeviceType: instance-store without explicitly warning that the root volume and all instance- store volumes will be LOST. Stop releases the host; no recovery path for ephemeral data.

  • NEVER manually stop an ASG-managed instance without first suspending HealthCheck. The ASG detects the stop, marks it Unhealthy, and terminates it — destroying in-flight work.

  • NEVER use the EC2 recover action for InstanceStatus: impaired. Recover only addresses SystemStatus (hardware). For OS issues, recover does nothing and the alarm keeps firing.

  • NEVER reboot an instance with a pending system-reboot scheduled event. The scheduled event runs automatically; a manual reboot masks the hardware issue and prevents AWS from applying the fix.

  • NEVER create a forensic AMI AFTER stopping or terminating the instance. AMI creation captures the running state. Stop clears in-memory state; terminate destroys the instance. AMI FIRST.

  • NEVER detach the root volume of a running instance without stopping it (use --force only if the instance is hung and stop is not completing). Forced detach can corrupt the filesystem.

  • NEVER assume State: running means the application is healthy. Verify the application's health check, not just EC2 status checks. A hung process keeps the instance running while idle.

  • NEVER forget to re-bind the Capacity Reservation on start. Stop releases the binding; start without --capacity-reservation- specification loses the reservation.

  • NEVER rely on get-console-output for historical diagnosis after a reboot. Each boot clears the prior log. Capture to a local file BEFORE any recovery action.

  • NEVER use create-image --no-reboot for production AMIs. It captures the filesystem in a potentially inconsistent state. Use ONLY for forensic snapshots of hung instances.

  • NEVER double-recover. If a CloudWatch recovery alarm already fired, check alarm history before triggering another recovery. Double- recovery extends downtime without fixing anything.

  • NEVER terminate an instance to "force recovery" without first detaching EBS volumes and capturing an AMI. Termination is irreversible.

  • NEVER auto-execute a state-changing EC2 recovery CLI without the CONFIRM gate. Stop, reboot, detach, terminate, and AMI creation all extend downtime or destroy data.

Pre-flight safety checks (run before any remediation CLI)

  • MANDATORY CONFIRMATION GATE. Before any state-changing operation, emit the CONFIRM prompt. Do NOT execute until the operator confirms.

  • Full defense-in-depth checklist (pre-state capture commands, AMI-first, ASG suspension, Capacity Reservation re-targeting, placement-group capacity): Advanced patterns.

Expert heuristic: stop/start vs. reboot

The single highest-leverage decision in EC2 recovery is:

Stop/start relocates the instance to a new physical host. Reboot stays on the same host. Match the operation to the impairment: SystemStatus: impaired → stop/start (host is bad). InstanceStatus: impaired → reboot or SSM access (host is fine, OS is not). Never use reboot for a hardware impairment — the instance stays on the broken host and the impairment persists.

Why this matters: Operators frequently confuse reboot with stop/start. Both appear to "restart" the instance, but they have opposite effects on the physical host. A reboot on an impaired host extends the outage. A stop/start on an OS issue adds 2-5 minutes of downtime without fixing anything.

Decision matrix:

Symptom Operation Why
SystemStatus: impaired, InstanceStatus: ok Stop/start OR CloudWatch recover Host hardware bad
InstanceStatus: impaired, SystemStatus: ok Reboot OR SSM session OS hung
Both impaired Diagnose first (console, ENI) Could be network/ENI
State: running, no SSH/SSM EBS detach/attach for filesystem repair OS unreachable
ASG-managed, health checks failing ASG-managed replacement ASG is the recovery loop
Pending system-reboot event Wait for AWS Manual reboot masks the issue
Pending instance-stop event Stop/start BEFORE the window Proactively relocate

Surface in the output: for any recovery, include HOST_CHANGE: <yes | no> and DATA_LOSS_RISK: <yes | no>. If DATA_LOSS_RISK: yes and the operator has not acknowledged, BLOCK.

Verification protocol (apply on every recovery):

  1. Status check restoration: describe-instance-status — both SystemStatus and InstanceStatus return ok.
  2. Application health: hit the workload's health endpoint. EC2 status checks do not verify the application.
  3. EBS integrity: describe-volumes — all volumes in-use.
  4. Capacity Reservation: confirm the binding (if applicable).
  5. Console output: capture post-recovery console log.

References (load on demand)

Domain

AWS CloudOps / EC2 Instance Recovery, Compute Resilience, and Forensic Preservation.

AWS documentation

04 同仓库更多 Skills

jhkchan
jhkchan/aws-agent-skills

xray-tracing-deployer

Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL / method / service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry / ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS / EKS / Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.

★ 4
jhkchan
jhkchan/aws-agent-skills

wellarchitected-workload-auditor

Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.

★ 4
jhkchan
jhkchan/aws-agent-skills

wellarchitected-review-operator

Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer / get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.

★ 4
jhkchan
jhkchan/aws-agent-skills

wafv2-web-acl-deployer

Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB/API Gateway/CloudFront, or configuring CAPTCHA/Challenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.

★ 4
jhkchan
jhkchan/aws-agent-skills

wafv2-web-acl-auditor

Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow/bypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.

★ 4
jhkchan
jhkchan/aws-agent-skills

waf-rule-deployer

Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.

★ 4