[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AD1WMMSDWSMQNV96QEE9VX":3,"skill-same:01M7AD1WMMSDWSMQNV96QEE9VX":149},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M7AD1WMMSDWSMQNV96QEE9VX","ssm-session-troubleshooter",null,"Diagnoses AWS Systems Manager Session Manager failures through a thirteen-category diagnostic tree: managed instance not showing up (SSM Agent not running, activation code expired, hybrid enrollment), session connection timeout (ssmmessages endpoint, Security group egress), SSM Agent version outdated (session features require minimum agent version), IAM role missing ssm:StartSession \u002F ssm:TerminateSession \u002F ssm:ResumeSession (AmazonSSMManagedInstanceCore), VPC endpoint for SSM missing one of the three required endpoints (ssm, ec2messages, ssmmessages), session document errors (SSM_Session document schema or sharing), port forwarding failures (local-port-forwarding document and target-host reachability), shell profile errors (SSM-SessionManagerRunShell profile misconfig), audit log delivery to S3 missing (S3 bucket policy for session-output), session recording to S3 (encryption and bucket Region), CloudWatch Logs delivery missing (log group permission on the instance role), macOS vs Linux agent...","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ssm-session-troubleshooter\ndescription: 'Diagnoses AWS Systems Manager Session Manager failures through a thirteen-category diagnostic tree: managed instance not showing up (SSM Agent not running, activation code expired, hybrid enrollment), session connection timeout (ssmmessages endpoint, Security group egress), SSM Agent version outdated (session features require minimum agent version), IAM role missing ssm:StartSession \u002F ssm:TerminateSession \u002F ssm:ResumeSession (AmazonSSMManagedInstanceCore), VPC endpoint for SSM missing one of the three required endpoints (ssm, ec2messages, ssmmessages), session document errors (SSM_Session document schema or sharing), port forwarding failures (local-port-forwarding document and target-host reachability), shell profile errors (SSM-SessionManagerRunShell profile misconfig), audit log delivery to S3 missing (S3 bucket policy for session-output), session recording to S3 (encryption and bucket Region), CloudWatch Logs delivery missing (log group permission on the instance role), macOS vs Linux agent...'\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline symptom classification works from pasted error messages and instance configuration. Live-account diagnosis uses aws ssm describe-instance-information, describe-sessions, get-document, describe-instance-properties, aws ec2 describe-instances \u002F describe-vpc-endpoints \u002F describe-security-groups, aws iam simulate-principal-policy on the instance role, aws logs describe-log-groups \u002F filter-log-events, aws...\nmetadata:\n  domain: aws-cloudops\n  complexity: high\n  requires_llm: 'true'\n  phase: '2'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Management\n  task_type: troubleshoot\n  skill_class: capability\n  lifecycle_status: active\n  verdict_shape: ROOT_CAUSE_IDENTIFIED | INSUFFICIENT_DATA\n  when_to_use: Diagnosing an SSM Session Manager failure (managed instance not showing in the console, session connection timeout, port forwarding failure, \"is not registered to the account or role\" error, missing audit logs in S3, missing CloudWatch Logs, session recording failure, shell profile error, patch-baseline-blocked session, SSM Document error, agent version too old for session features), walking a symptom to the failed layer with verify and fix commands, validating why a session cannot start or connect, or triaging a \"Session Manager is broken\" page where the root cause may be agent, IAM role, VPC endpoint, document, shell profile, or audit-log config — not necessarily the SSM service itself.\n  when_not_to_use: SSM Run Command \u002F Automation execution debugging (use ssm-automation-deployer or a run-command skill), EC2 instance reachability at the OS level (use ec2-instance-reachability checks), patch compliance posture audits (use ssm-patch-compliance-automator), or IAM policy authoring for the instance role (use iam-least-privilege-advisor). This skill diagnoses Session Manager connectivity and session-output failures; it does not audit patch baseline posture or debug Run Command document execution.\n  activation_triggers: SSM Session Manager connection failed, SSM session timeout, managed instance not showing up, instance not registered SSM, SSM Agent not running, ssm:StartSession denied, SSM port forwarding failed, channel closed Session Manager, ssmmessages endpoint, VPC endpoint SSM missing, SSM session recording S3, SSM audit logs missing, SessionManagerRunShell, SSM Document error, SSM agent version outdated, hybrid activation expired, patch baseline blocking session, troubleshoot SSM Session Manager\n  invocation_schema: 'Input: either (a) a symptom description (error message, observed behaviour, \"session times out after 10s\", \"instance not in the console\"), optionally paired with the instance configuration (describe-instance-information output) and recent SSM \u002F CloudWatch logs, OR (b) an InstanceId plus session context (document name, session id, target host for port forwarding, VPC endpoint config) for live-account diagnosis. Output: a deterministic TARGET\u002FVERDICT\u002FREASON\u002FLAYER\u002FEVIDENCE\u002FREMEDIATION block where VERDICT ∈ {ROOT_CAUSE_IDENTIFIED, INSUFFICIENT_DATA} and LAYER ∈ {INSTANCE_NOT_REGISTERED, SESSION_CONNECTION_TIMEOUT, AGENT_OUTDATED, IAM_PERMISSION_MISSING, VPC_ENDPOINT_MISSING, SESSION_DOCUMENT_ERROR, PORT_FORWARDING_FAILURE, SHELL_PROFILE_ERROR, AUDIT_LOG_S3_MISSING, SESSION_RECORDING_S3, CLOUDWATCH_LOGS_MISSING, PATCH_BASELINE_BLOCKING, SSM_DOCUMENT_ERROR, UNKNOWN}.'\n  invocation_example: '# Minimal valid input (offline symptom classification):\n\n    Symptom: \"EC2 instance i-0abcdef1234567890 in a private subnet does\n\n    not appear in the SSM Fleet Manager console. The instance\n\n    has the AmazonSSMManagedInstanceCore role attached but is\n\n    in a VPC with no ssmmessages VPC endpoint. Sessions started\n\n    from other instances in a public subnet work fine.\"\n\n    InstanceId: i-0abcdef1234567890\n\n    VPC: vpc-priv (no internet gateway, no NAT gateway)\n\n    InstanceRole: EC2-SSM-Role (AmazonSSMManagedInstanceCore attached)\n\n    VPC endpoints configured: ssm (interface), ec2messages (interface)\n\n    VPC endpoints MISSING: ssmmessages\n\n    Last log line: \"Session Manager connection timed out\"'\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: SSM, Session Manager, ssm:StartSession, SSM Agent, AmazonSSMManagedInstanceCore, VPC endpoint, ssmmessages, ec2messages, port forwarding, shell profile, session recording, S3 audit logs, CloudWatch Logs, hybrid enrollment, activation code, patch baseline, SSM Document, troubleshooting\n  tags: ssm, management, troubleshooting, session-manager, vpc-endpoint, iam-role, port-forwarding, session-recording, audit-logs\n---\n\n# SSM Session Troubleshooter\n\n## Quick start\n\n- **Symptom → layer map (first plausible match drives the first probe):**\n  instance not in Fleet Manager console → INSTANCE_NOT_REGISTERED\n  \u002F AGENT_OUTDATED; session times out after starting →\n  SESSION_CONNECTION_TIMEOUT \u002F VPC_ENDPOINT_MISSING;\n  `AccessDeniedException` on StartSession → IAM_PERMISSION_MISSING;\n  port forwarding fails to connect → PORT_FORWARDING_FAILURE \u002F\n  SESSION_CONNECTION_TIMEOUT; `ChannelClosedException` \u002F\n  shell-profile errors → SHELL_PROFILE_ERROR; session output not\n  in S3 → AUDIT_LOG_S3_MISSING \u002F SESSION_RECORDING_S3; CloudWatch\n  Logs missing → CLOUDWATCH_LOGS_MISSING; session fails during\n  maintenance window → PATCH_BASELINE_BLOCKING; document schema\n  error → SESSION_DOCUMENT_ERROR \u002F SSM_DOCUMENT_ERROR.\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#quick-start--verification-and-coverage-rules).\n> Probe-driven verdicts, the three-endpoint rule for private subnets (missing ssmmessages = session timeouts), AmazonSSMManagedInstanceCore ssmmessages actions, agent version gates (2.3.68.0 sessions \u002F 3.0.196 port-forwarding \u002F 3.1.x macOS).\n\n## Mindset\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#mindset).\n> SSM service is usually innocent: the broken layer is agent, instance-role IAM, one of the three VPC endpoints, the session document, the shell profile, or the audit-log bucket policy. Start with describe-instance-information, describe-vpc-endpoints, and simulate-principal-policy.\n\n## Philosophy\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#philosophy).\n> Control plane (ssm) vs data plane (ssmmessages) vs ec2messages; registration != session-ready; role gates StartSession AND ssmmessages data channel; session output configured at the document level, not the instance level.\n\n## Quick reference — symptom triage table\n\n| Symptom phrase \u002F error | Most likely layer | First probe |\n|---|---|---|\n| Instance absent from Fleet Manager \u002F `describe-instance-information` returns empty | INSTANCE_NOT_REGISTERED | `describe-instance-information`, EC2 userdata \u002F agent install log |\n| Instance `PingStatus: ConnectionLost` \u002F `InActive` | INSTANCE_NOT_REGISTERED \u002F AGENT_OUTDATED | `describe-instance-information` AgentVersion, LastPingDateTime |\n| Session starts on client, then \"Connection timed out\" \u002F `ChannelClosedException` | SESSION_CONNECTION_TIMEOUT \u002F VPC_ENDPOINT_MISSING | `describe-vpc-endpoints` for ssm\u002Fec2messages\u002Fssmmessages; SG egress to endpoints |\n| `AccessDeniedException` on `start-session` CLI call (caller side) | IAM_PERMISSION_MISSING (caller) | `iam simulate-principal-policy` on the caller's role for `ssm:StartSession` |\n| Session starts, agent log shows `ssmmessages:OpenDataChannel AccessDenied` | IAM_PERMISSION_MISSING (instance role) | `iam simulate-principal-policy` on the instance role for `ssmmessages:OpenDataChannel` |\n| Port forwarding connects but target host unreachable | PORT_FORWARDING_FAILURE | `ssm start-session` document name, target host reachability from the instance |\n| Port forwarding fails with `NotSupported` on the agent | AGENT_OUTDATED | `describe-instance-information` AgentVersion \u003C 3.0.196 |\n| `InvalidDocument` or `InvalidDocumentVersion` on session start | SESSION_DOCUMENT_ERROR \u002F SSM_DOCUMENT_ERROR | `ssm get-document --name SSM-SessionManagerRunShell` |\n| Session opens, exits immediately, `amazon-ssm-agent.log` shows shell profile error | SHELL_PROFILE_ERROR | agent log for `SessionTypeHandler` \u002F profile errors |\n| Sessions work but no JSON output in the S3 session bucket | AUDIT_LOG_S3_MISSING | `get-document` S3 bucket, `get-bucket-policy` for ssm-output grant |\n| Session recording missing from S3; shell scrollback truncated | SESSION_RECORDING_S3 | document `s3BucketName`, KMS key policy, bucket Region |\n| Sessions work but CloudWatch Logs group is empty | CLOUDWATCH_LOGS_MISSING | document `cloudWatchLogGroupName`, role `logs:CreateLogStream` |\n| Sessions fail during a maintenance window; `ScanOnly` association in `Running` state | PATCH_BASELINE_BLOCKING | `describe-association`, `describe-instance-associations-status` |\n| macOS instance cannot start session; agent installed but session API errors | AGENT_OUTDATED | AgentVersion \u003C 3.1.x for macOS session support |\n| None of the above; region-wide SSM event | INSUFFICIENT_DATA | `aws health describe-events`, AWS Service Health Dashboard |\n\n## Pre-flight: instance and session state\n\nGather the canonical configuration and short-circuit on instance\nstates that mimic session failures. Misclassifying these produces\nhours of session debugging for a problem that is not a session\nproblem.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#pre-flight-probes-instance-and-session-state).\n> Eight probes: describe-instance-information \u002F -properties, describe-sessions, get-document, instance-role simulate-principal-policy (ssm + ssmmessages + s3\u002Flogs actions), describe-vpc-endpoints, security-group egress, agent-log filter, AWS Health.\n\n### Instance-state short-circuit\n\n| `PingStatus` \u002F `describe-instance-information` | Effect on diagnosis |\n|---|---|\n| `Online` + recent `LastPingDateTime` | Agent control channel works; if sessions fail, the issue is data channel, IAM, document, or network — not registration. |\n| `ConnectionLost` \u002F `InActive` | Agent stopped, instance stopped, or network break. The instance will not appear in Fleet Manager. Start at INSTANCE_NOT_REGISTERED. |\n| Instance absent from `describe-instance-information` | Either the agent is not installed\u002Frunning, the instance role lacks `ssm:UpdateInstanceInformation`, or the instance cannot reach `ssm.*.amazonaws.com`. Start at INSTANCE_NOT_REGISTERED. |\n| `AgentVersion: 2.x.x` (below 2.3.68) | Session Manager not supported on this agent version. Sessions fail with `NotSupported` or silently. AGENT_OUTDATED. |\n| `AgentVersion: 3.0.x` below 3.0.196 | Port forwarding not supported. PORT_FORWARDING_FAILURE due to AGENT_OUTDATED. |\n| `PlatformName: Mac OS` + agent below 3.1.x | Session Manager not supported on macOS below 3.1. AGENT_OUTDATED. |\n\nIf input is malformed (missing InstanceId, absent symptom\ndescription, no document name for document errors), emit:\n\n```text\nTARGET: \u003Cinstance-id or unknown>\nVERDICT: INSUFFICIENT_DATA\nREASON: Input is missing required context — at minimum a symptom\n  description (error string or observed behaviour) and the\n  InstanceId, plus for document\u002Foutput errors the session document\n  name and the target S3 bucket or CloudWatch log group.\nLAYER: UNKNOWN\nEVIDENCE:\n  - Missing: \u003Clist specific missing fields>\nREMEDIATION: Re-prompt for: (1) the exact error string or observed\n  symptom, (2) the InstanceId and platform (Linux \u002F macOS \u002F\n  Windows), (3) the instance VPC and whether it has internet\n  access, and (4) for output\u002Faudit errors, the session document\n  name and the target S3 bucket \u002F CloudWatch log group.\n```\n\n## Process — Diagnostic decision tree (apply in symptom order)\n\nSymptom-driven. Pick the entry point based on the observed symptom,\nthen walk the layer-specific probes in order. **Never emit\nROOT_CAUSE_IDENTIFIED without a failing probe that matches the\nsymptom.**\n\n### Step 0: Non-obvious behaviours that change diagnosis\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#step-0-non-obvious-behaviours-that-change-diagnosis).\n> Three-endpoint rule, StartSession on the caller vs ssmmessages on the instance, AmazonEC2RoleforSSM deprecation, agent version floors and self-update via S3, document-carried audit config, shell-profile instant-close, hybrid activation expiry, patch associations slowing the data channel, macOS agent differences, stale Active sessions.\n\n### Step 1: Instance registration layer\n\nEntry: instance absent from Fleet Manager \u002F\n`describe-instance-information` returns empty for the instance.\n\n1. **Is the instance running and does it have an instance profile?**\n   ```bash\n   aws ec2 describe-instances --instance-ids \u003Ci-id> \\\n     --query 'Reservations[0].Instances[0].[State.Name,IamInstanceProfile.Arn]' --output text\n   ```\n   - State `stopped` → start the instance first.\n   - No instance profile ARN → the role is missing; attach one.\n     **INSTANCE_NOT_REGISTERED.**\n\n2. **Does the instance role include AmazonSSMManagedInstanceCore?**\n   ```bash\n   aws iam list-attached-role-policies --role-name \u003Crole-name> --output json\n   ```\n   - AmazonSSMManagedInstanceCore NOT attached → the agent cannot\n     call `ssm:UpdateInstanceInformation`. **INSTANCE_NOT_REGISTERED.**\n   - Legacy `AmazonEC2RoleforSSM` → deprecated; switch to\n     AmazonSSMManagedInstanceCore.\n\n3. **Can the agent reach the SSM endpoint?**\n   - Public subnet: route to IGW; agent reaches `ssm.\u003Cregion>.amazonaws.com`.\n   - Private subnet with NAT: route to NAT; agent reaches the\n     public SSM endpoint.\n   - Private subnet without NAT: needs `ssm`, `ec2messages`, and\n     `ssmmessages` interface VPC endpoints.\n   - VPC endpoint missing → agent never registers.\n     **INSTANCE_NOT_REGISTERED (network).**\n\n4. **Is the SSM Agent running on the instance?**\n   On the instance:\n   ```bash\n   sudo systemctl status amazon-ssm-agent          # Linux systemd\n   sudo launchctl list | grep amazon-ssm-agent     # macOS\n   Get-Service AmazonSSMAgent                       # Windows PowerShell\n   ```\n   - Agent not installed or stopped → install or start it.\n     **INSTANCE_NOT_REGISTERED.**\n\n5. **For hybrid (non-EC2) instances: is the activation valid?**\n   ```bash\n   aws ssm describe-activations --output json\n   ```\n   - `ExpiredDate` in the past or `RegistrationLimit` reached →\n     the agent cannot re-register after a restart.\n     **INSTANCE_NOT_REGISTERED (hybrid).**\n\nIf the instance is running, the role is correct, the agent is\ninstalled, but registration still fails, move to the VPC endpoint\nlayer (Step 5) — the agent may not be reaching `ssm.*`.\n\n### Step 2: IAM permission layer (instance role)\n\nEntry: session starts on the client then times out, or agent log\nshows `ssmmessages:OpenDataChannel AccessDenied`.\n\n```bash\naws iam simulate-principal-policy \\\n  --policy-source-arn \"\u003Cinstance-role-arn>\" \\\n  --action-names ssm:UpdateInstanceInformation \\\n    ssmmessages:CreateControlChannel ssmmessages:CreateDataChannel \\\n    ssmmessages:OpenControlChannel ssmmessages:OpenDataChannel \\\n    s3:PutObject logs:CreateLogStream \\\n  --output json\n```\n\n- Any action that returns `implicitDeny` or `explicitDeny` confirms\n  the role is missing the permission. **IAM_PERMISSION_MISSING.**\n- `ssmmessages:OpenDataChannel` denied → session times out within\n  seconds of starting on the client.\n- `s3:PutObject` on the session-output bucket denied → sessions\n  work but audit logs never land in S3. Cross-reference Step 7.\n- `logs:CreateLogStream` denied → sessions work but CloudWatch\n  Logs group stays empty. Cross-reference Step 9.\n\nFor the caller's role (the human or service invoking StartSession):\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-2--caller-role-probe).\n> simulate-principal-policy on the caller's role for ssm:StartSession \u002F ssm:TerminateSession scoped to the instance and SSM-SessionManagerRunShell document ARNs.\n- `ssm:StartSession` denied on the caller side → the CLI\u002FAPI call\n  returns `AccessDeniedException` immediately, before any session\n  is attempted. **IAM_PERMISSION_MISSING (caller).**\n\n### Step 3: VPC endpoint layer\n\nEntry: instance `Online` (registered) but session times out;\nprivate subnet with no internet egress.\n\n```bash\nVPC_ID=$(aws ec2 describe-instances --instance-ids \u003Ci-id> \\\n  --query 'Reservations[0].Instances[0].VpcId' --output text)\naws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=$VPC_ID \\\n  --query 'VpcEndpoints[?contains(ServiceName,`ssm`)].[ServiceName,State,VpcEndpointType]' --output table\n```\n\nRequired endpoints (interface type) for private-subnet SSM:\n\n| Endpoint service | Required for |\n|---|---|\n| `com.amazonaws.\u003Cregion>.ssm` | Control plane: registration, StartSession API |\n| `com.amazonaws.\u003Cregion>.ec2messages` | Run Command \u002F Association delivery |\n| `com.amazonaws.\u003Cregion>.ssmmessages` | Session data channel (the actual terminal stream) |\n\n- Missing `ssmmessages` → session times out within seconds. The\n  most common SSM session failure. **VPC_ENDPOINT_MISSING.**\n- Missing `ssm` → instance never registers (cross-reference Step 1).\n- Endpoint present but `State: Pending` \u002F `Failed` → the endpoint\n  is not yet usable; wait for `Available`.\n\nAlso check the endpoint security group: the VPC endpoint's SG\nmust allow 443 inbound from the instance's subnet\u002Feni. A VPC\nendpoint with no inbound rule on 443 is unreachable from the\ninstance.\n\n### Step 4: Session connection timeout layer\n\nEntry: session starts, then times out; VPC endpoints all present\nand IAM passes.\n\n1. **Security group egress on the instance.**\n   ```bash\n   aws ec2 describe-security-groups --group-ids \u003Csg-id> \\\n     --query 'SecurityGroups[0].IpPermissionsEgress' --output json\n   ```\n   - No egress on 443 to the VPC endpoint CIDRs or the service\n     ranges → the agent cannot reach `ssmmessages.*.amazonaws.com`.\n     **SESSION_CONNECTION_TIMEOUT.**\n\n2. **DNS resolution for the endpoint.**\n   - Interface VPC endpoints use private DNS by default. If private\n     DNS is disabled, the instance resolves `ssmmessages.*` to the\n     public IP and the session fails in a no-egress VPC.\n   - Check `describe-vpc-endpoints` for `PrivateDnsEnabled: true`.\n\n3. **Instance-side agent log.**\n   ```bash\n   tail -n 200 \u002Fvar\u002Flog\u002Famazon\u002Fssm\u002Famazon-ssm-agent.log | grep -iE \"session|ssmmessages|timeout\"\n   ```\n   - `dial tcp: i\u002Fo timeout` reaching `ssmmessages.*` → network\n     path broken. **SESSION_CONNECTION_TIMEOUT.**\n   - `403 Forbidden` on `ssmmessages:OpenDataChannel` → IAM (Step 2).\n\n### Step 5: Agent version layer\n\nEntry: port forwarding or session feature returns `NotSupported`;\nmacOS instance cannot start sessions.\n\n```bash\naws ssm describe-instance-information \\\n  --filters Key=InstanceIds,Values=\u003Ci-id> \\\n  --query 'InstanceInformationList[].AgentVersion' --output text\n```\n\n| Agent version | Session Manager | Port forwarding | macOS session |\n|---|---|---|---|\n| \u003C 2.3.68.0 | Not supported | Not supported | Not supported |\n| 2.3.68.0 – 2.3.x | Supported | Not supported | Not supported |\n| 3.0.196+ | Supported | Supported | Not supported |\n| 3.1.x+ | Supported | Supported | Supported |\n\n- Below 2.3.68 → sessions fail with `NotSupported` or silently.\n  **AGENT_OUTDATED.**\n- Below 3.0.196 → port forwarding returns `NotSupported`.\n  **AGENT_OUTDATED (port forwarding).**\n- macOS below 3.1 → session API errors. **AGENT_OUTDATED (macOS).**\n\nAgent self-update requires reaching `s3.*.amazonaws.com` or an S3\nVPC endpoint. A locked-down private subnet without an S3 endpoint\nstays on the old agent.\n\n### Step 6: Session document layer\n\nEntry: `InvalidDocument`, `InvalidDocumentVersion`, or document\nschema errors on session start.\n\n```bash\naws ssm get-document --name \u003Cdocument-name> --output json | jq '.'\naws ssm describe-document --name \u003Cdocument-name> --output json | jq '.'\n```\n\n- Document `Status: Failed` or `SchemaVersion` not `1.0` for a\n  session document → document error. **SESSION_DOCUMENT_ERROR.**\n- The default document `SSM-SessionManagerRunShell` should have\n  `DocumentType: Session`. If `DocumentType` is `Command` or the\n  schema is wrong, sessions fail. **SSM_DOCUMENT_ERROR.**\n- For a custom document, the schema must match the session document\n  schema (inputs for `s3BucketName`, `cloudWatchLogGroupName`,\n  `kmsKeyId`, `shellProfile`). Missing fields default to no output.\n- Document sharing: a session document must be shared with the\n  caller account if cross-account. Missing share →\n  `AccessDeniedException` on StartSession.\n\n### Step 7: Port forwarding layer\n\nEntry: port forwarding command connects but the forwarded port\ncannot reach the target.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-7--port-forwarding-probe).\n> start-session --document-name AWS-StartPortForwardingSession with portNumber\u002FhostName parameters.\n\n1. **Document name.** The default port-forwarding document is\n   `AWS-StartPortForwardingSession` (managed). A custom document\n   must be `Session` type and use the port-forwarding schema.\n2. **Target host reachability.** The `hostName` is resolved from\n   the INSTANCE, not the caller. If the instance cannot route to\n   `hostName` (different VPC, SG block), the forwarded port\n   connects to nothing. **PORT_FORWARDING_FAILURE.**\n3. **Agent version.** Port forwarding requires agent >= 3.0.196.\n   Below → `NotSupported`. **AGENT_OUTDATED.**\n\n### Step 8: Shell profile layer\n\nEntry: session opens and closes immediately; agent log shows\n`SessionTypeHandler` errors.\n\n```bash\n# On the instance, tail the agent log\ntail -n 200 \u002Fvar\u002Flog\u002Famazon\u002Fssm\u002Famazon-ssm-agent.log | grep -iE \"SessionTypeHandler|shell|profile\"\n```\n\n- `.bashrc` with an `exit` \u002F `logout` → session closes immediately.\n  **SHELL_PROFILE_ERROR.**\n- `.bash_profile` syntax error → session fails to spawn the shell.\n  **SHELL_PROFILE_ERROR.**\n- Custom `shellProfile` in the session document pointing to a\n  non-existent binary → session opens, exits.\n  **SHELL_PROFILE_ERROR.**\n\n### Step 9: Audit log \u002F session output to S3 layer\n\nEntry: sessions work but no JSON output in the S3 session bucket.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-9--audit-log--s3-output-probe).\n> get-document s3BucketName\u002Fs3KeyPrefix, get-bucket-policy, head-bucket on the session-output bucket.\n\n- Document `s3BucketName` empty → no S3 output configured. Add the\n  bucket name in the document. **AUDIT_LOG_S3_MISSING.**\n- Bucket policy missing the grant for\n  `arn:aws:iam::\u003Caccount>:role\u002F\u003Cinstance-role>` `s3:PutObject` on\n  `arn:aws:s3:::\u003Cbucket>\u002F\u003Cprefix>\u002F*` → the agent writes but S3\n  rejects. **AUDIT_LOG_S3_MISSING.**\n- Bucket Region vs document Region mismatch → the agent writes to\n  the wrong Region endpoint.\n- SSE-KMS bucket where the role lacks `kms:GenerateDataKey` → write\n  fails. **SESSION_RECORDING_S3.**\n\nFor session recording (shell scrollback), the same bucket and a\nlonger `s3KeyPrefix` apply. If scrollback is truncated, check the\ndocument's `cloudWatchLogGroupName` (separate stream) and the\nrecording-enabled flag.\n\n### Step 10: CloudWatch Logs delivery layer\n\nEntry: sessions work but the CloudWatch Logs group is empty.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-10--cloudwatch-logs-delivery-probe).\n> get-document cloudWatchLogGroupName\u002FcloudWatchStreamingEnabled, describe-log-groups, role logs:CreateLogStream\u002FPutLogEvents simulation.\n\n- Document `cloudWatchLogGroupName` empty → no CW Logs output\n  configured. **CLOUDWATCH_LOGS_MISSING.**\n- Role missing `logs:CreateLogStream` \u002F `logs:PutLogEvents` → agent\n  cannot write. **CLOUDWATCH_LOGS_MISSING.**\n- Log group in a different account without resource-policy grant\n  to the SSM service → writes denied.\n\n### Step 11: Patch baseline blocking layer\n\nEntry: sessions fail during a maintenance window; `ScanOnly` or\n`Install` association in `Running` state.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-11--patch-baseline-association-probe).\n> describe-instance-associations-status and describe-association to detect a Running ScanOnly\u002FInstall association during the session failure window.\n\n- Association `Status: Running` during a patch window → agent busy;\n  session data channel may be slow to open. Rare; usually resolves\n  when the patch completes. **PATCH_BASELINE_BLOCKING.**\n- If the association is `Failed`, the patch itself errored; sessions\n  are unaffected. Different root cause.\n\n### Step 12: INSUFFICIENT_DATA — when none of the layers confirm\n\nIf every probe passes and no failing probe matches the symptom,\nemit INSUFFICIENT_DATA. List the passing probes in EVIDENCE.\nRecommend escalation to AWS Support with the instance id, session\nid, and the failing probe outputs.\n\n## Output specification — diagnostic block\n\n```text\nTARGET: \u003Cinstance-id with session\u002Fdocument context>\nVERDICT: ROOT_CAUSE_IDENTIFIED | INSUFFICIENT_DATA\nREASON: \u003C1-3 sentences naming the failed layer and the failing probe>\nLAYER: \u003CINSTANCE_NOT_REGISTERED | SESSION_CONNECTION_TIMEOUT |\n        AGENT_OUTDATED | IAM_PERMISSION_MISSING |\n        VPC_ENDPOINT_MISSING | SESSION_DOCUMENT_ERROR |\n        PORT_FORWARDING_FAILURE | SHELL_PROFILE_ERROR |\n        AUDIT_LOG_S3_MISSING | SESSION_RECORDING_S3 |\n        CLOUDWATCH_LOGS_MISSING | PATCH_BASELINE_BLOCKING |\n        SSM_DOCUMENT_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Cobserved symptom — error string or behaviour>\n  - \u003Cfailing probe — command and its output that confirms the cause>\n  - \u003Cpassing probes — layers ruled out>\nREMEDIATION:\n  1. \u003Cspecific action with CLI command or API call>\n  2. \u003Cverification command after the fix>\n```\n\nField rules:\n\n- `TARGET` includes the instance id and, when applicable, the\n  session document name and session id.\n- `VERDICT` is one of the two enumerated values.\n- `EVIDENCE` always includes (a) symptom, (b) failing probe output,\n  (c) at least one passing probe ruling out a competing layer.\n\n## Pre-flight safety checks (run before any state-changing CLI)\n\n- **MANDATORY CONFIRMATION GATE.** Before any state-changing\n  operation (`start-session`, `terminate-session`, `put-document`,\n  `update-document`, `create-vpc-endpoint`, `attach-role-policy`,\n  `put-bucket-policy`), emit and await operator approval.\n- **Read-only first.** Every probe in the diagnostic tree is\n  read-only. Do not perform state-changing operations as probes.\n- **`terminate-session`** closes a live session the operator may be\n  using. Confirm before terminating; check `describe-sessions\n  --state Active` first.\n- **`update-document` on SSM-SessionManagerRunShell** affects every\n  session using the default document. Use a custom document for\n  testing changes before applying to the default.\n- **`create-vpc-endpoint`** is billed hourly; confirm the endpoint\n  is needed before creating. The three SSM endpoints (~$0.01\u002Fhour\n  each in us-east-1) are cheap but accrue.\n- **Role policy changes** affect every instance using that role.\n  Use a test role on a test instance before applying to production.\n\n## Remediation guidance\n\n> Moved to [references\u002Ferror-handling.md](references\u002Ferror-handling.md#remediation-guidance).\n> Per-layer fix CLIs: associate-iam-instance-profile + Core policy + agent start (INSTANCE_NOT_REGISTERED), ssmmessages inline policy (IAM), create-vpc-endpoint ssmmessages, SG egress + private DNS (TIMEOUT), agent update commands per OS, document reset (DOCUMENT), port-forwarding checks, shell profile fixes, S3 bucket policy + kms:GenerateDataKey, CloudWatch Logs config, patch-window reschedule.\n\n## Deep reference\n\n### Symptom → layer decision matrix\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#symptom--layer-decision-matrix).\n> 12-row error-string\u002Fbehaviour -> LAYER decision matrix (instance absent, ConnectionLost, ChannelClosedException, AccessDeniedException caller vs agent log, NotSupported, InvalidDocument, instant close, empty bucket\u002Flogs, macOS).\n\n### Session document schema (SSM-SessionManagerRunShell)\n\n> Moved to [references\u002Fsession-output-and-document-reference.md](references\u002Fsession-output-and-document-reference.md#session-document-schema-ssm-sessionmanagerrunshell).\n> Full JSON schema of the default session document: s3BucketName\u002Fs3KeyPrefix\u002Fs3EncryptionEnabled, cloudWatchLogGroupName\u002FcloudWatchStreamingEnabled, kmsKeyId, runAs*, shellProfile; empty output fields disable audit paths.\n\n## Recent AWS features (2024-2026)\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#recent-aws-features-2024-2026).\n> CloudWatch streaming semantics, AWS-StartPortForwardingSessionToRemoteHost, macOS 3.1.x session support, scrollback recording, VPC endpoint resource policies.\n\n## References (load on demand)\n\n- [advanced-patterns](references\u002Fadvanced-patterns.md) — Mindset, Philosophy (control vs data plane), quick-start coverage rules, Step 0 non-obvious behaviours, symptom-to-layer decision matrix, Recent AWS features\n- [diagnostic-commands](references\u002Fdiagnostic-commands.md) — pre-flight probes, the Step 2 caller-role probe, and the Step 7\u002F9\u002F10\u002F11 per-layer probe commands moved from SKILL.md\n- [error-handling](references\u002Ferror-handling.md) — per-layer remediation fix commands moved from SKILL.md\n- [session-output-and-document-reference](references\u002Fsession-output-and-document-reference.md) — session document schema, audit-log bucket policies, CloudWatch Logs delivery, shell profiles, port-forwarding document variants\n- [vpc-endpoint-and-iam-reference](references\u002Fvpc-endpoint-and-iam-reference.md) — three-endpoint matrix, instance-role and caller-role permission maps, agent version support matrix\n\n## Domain\n\nAWS CloudOps \u002F Systems Manager Session Manager, Instance\nRegistration Diagnostics, VPC Endpoint Configuration, IAM Role\nPermissions, Session Output and Audit Log Delivery, Port\nForwarding, and Shell Profile Management.\n\n## AWS documentation\n\n- **AWS Systems Manager Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager.html\n- **Setting up Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-getting-started.html\n- **Working with Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-working-with-sessions.html\n- **Troubleshooting Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-troubleshooting.html\n- **VPC endpoints for Systems Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsetup-create-vpc.html\n- **AmazonSSMManagedInstanceCore policy** — https:\u002F\u002Fdocs.aws.amazon.com\u002Faws-managed-policy\u002Flatest\u002Freference\u002FAmazonSSMManagedInstanceCore.html\n- **SSM Agent version history** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fssm-agent.html\n- **Session Manager auditing** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-auditing.html\n- **Port forwarding with Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-working-with-sessions-port-forwarding.html\n- **AWS Health** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fhealth\u002Flatest\u002Fug\u002F\n","# SSM Session Troubleshooter\n\n## Quick start\n\n- **Symptom → layer map (first plausible match drives the first probe):**\n  instance not in Fleet Manager console → INSTANCE_NOT_REGISTERED\n  \u002F AGENT_OUTDATED; session times out after starting →\n  SESSION_CONNECTION_TIMEOUT \u002F VPC_ENDPOINT_MISSING;\n  `AccessDeniedException` on StartSession → IAM_PERMISSION_MISSING;\n  port forwarding fails to connect → PORT_FORWARDING_FAILURE \u002F\n  SESSION_CONNECTION_TIMEOUT; `ChannelClosedException` \u002F\n  shell-profile errors → SHELL_PROFILE_ERROR; session output not\n  in S3 → AUDIT_LOG_S3_MISSING \u002F SESSION_RECORDING_S3; CloudWatch\n  Logs missing → CLOUDWATCH_LOGS_MISSING; session fails during\n  maintenance window → PATCH_BASELINE_BLOCKING; document schema\n  error → SESSION_DOCUMENT_ERROR \u002F SSM_DOCUMENT_ERROR.\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#quick-start--verification-and-coverage-rules).\n> Probe-driven verdicts, the three-endpoint rule for private subnets (missing ssmmessages = session timeouts), AmazonSSMManagedInstanceCore ssmmessages actions, agent version gates (2.3.68.0 sessions \u002F 3.0.196 port-forwarding \u002F 3.1.x macOS).\n\n## Mindset\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#mindset).\n> SSM service is usually innocent: the broken layer is agent, instance-role IAM, one of the three VPC endpoints, the session document, the shell profile, or the audit-log bucket policy. Start with describe-instance-information, describe-vpc-endpoints, and simulate-principal-policy.\n\n## Philosophy\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#philosophy).\n> Control plane (ssm) vs data plane (ssmmessages) vs ec2messages; registration != session-ready; role gates StartSession AND ssmmessages data channel; session output configured at the document level, not the instance level.\n\n## Quick reference — symptom triage table\n\n| Symptom phrase \u002F error | Most likely layer | First probe |\n|---|---|---|\n| Instance absent from Fleet Manager \u002F `describe-instance-information` returns empty | INSTANCE_NOT_REGISTERED | `describe-instance-information`, EC2 userdata \u002F agent install log |\n| Instance `PingStatus: ConnectionLost` \u002F `InActive` | INSTANCE_NOT_REGISTERED \u002F AGENT_OUTDATED | `describe-instance-information` AgentVersion, LastPingDateTime |\n| Session starts on client, then \"Connection timed out\" \u002F `ChannelClosedException` | SESSION_CONNECTION_TIMEOUT \u002F VPC_ENDPOINT_MISSING | `describe-vpc-endpoints` for ssm\u002Fec2messages\u002Fssmmessages; SG egress to endpoints |\n| `AccessDeniedException` on `start-session` CLI call (caller side) | IAM_PERMISSION_MISSING (caller) | `iam simulate-principal-policy` on the caller's role for `ssm:StartSession` |\n| Session starts, agent log shows `ssmmessages:OpenDataChannel AccessDenied` | IAM_PERMISSION_MISSING (instance role) | `iam simulate-principal-policy` on the instance role for `ssmmessages:OpenDataChannel` |\n| Port forwarding connects but target host unreachable | PORT_FORWARDING_FAILURE | `ssm start-session` document name, target host reachability from the instance |\n| Port forwarding fails with `NotSupported` on the agent | AGENT_OUTDATED | `describe-instance-information` AgentVersion \u003C 3.0.196 |\n| `InvalidDocument` or `InvalidDocumentVersion` on session start | SESSION_DOCUMENT_ERROR \u002F SSM_DOCUMENT_ERROR | `ssm get-document --name SSM-SessionManagerRunShell` |\n| Session opens, exits immediately, `amazon-ssm-agent.log` shows shell profile error | SHELL_PROFILE_ERROR | agent log for `SessionTypeHandler` \u002F profile errors |\n| Sessions work but no JSON output in the S3 session bucket | AUDIT_LOG_S3_MISSING | `get-document` S3 bucket, `get-bucket-policy` for ssm-output grant |\n| Session recording missing from S3; shell scrollback truncated | SESSION_RECORDING_S3 | document `s3BucketName`, KMS key policy, bucket Region |\n| Sessions work but CloudWatch Logs group is empty | CLOUDWATCH_LOGS_MISSING | document `cloudWatchLogGroupName`, role `logs:CreateLogStream` |\n| Sessions fail during a maintenance window; `ScanOnly` association in `Running` state | PATCH_BASELINE_BLOCKING | `describe-association`, `describe-instance-associations-status` |\n| macOS instance cannot start session; agent installed but session API errors | AGENT_OUTDATED | AgentVersion \u003C 3.1.x for macOS session support |\n| None of the above; region-wide SSM event | INSUFFICIENT_DATA | `aws health describe-events`, AWS Service Health Dashboard |\n\n## Pre-flight: instance and session state\n\nGather the canonical configuration and short-circuit on instance\nstates that mimic session failures. Misclassifying these produces\nhours of session debugging for a problem that is not a session\nproblem.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#pre-flight-probes-instance-and-session-state).\n> Eight probes: describe-instance-information \u002F -properties, describe-sessions, get-document, instance-role simulate-principal-policy (ssm + ssmmessages + s3\u002Flogs actions), describe-vpc-endpoints, security-group egress, agent-log filter, AWS Health.\n\n### Instance-state short-circuit\n\n| `PingStatus` \u002F `describe-instance-information` | Effect on diagnosis |\n|---|---|\n| `Online` + recent `LastPingDateTime` | Agent control channel works; if sessions fail, the issue is data channel, IAM, document, or network — not registration. |\n| `ConnectionLost` \u002F `InActive` | Agent stopped, instance stopped, or network break. The instance will not appear in Fleet Manager. Start at INSTANCE_NOT_REGISTERED. |\n| Instance absent from `describe-instance-information` | Either the agent is not installed\u002Frunning, the instance role lacks `ssm:UpdateInstanceInformation`, or the instance cannot reach `ssm.*.amazonaws.com`. Start at INSTANCE_NOT_REGISTERED. |\n| `AgentVersion: 2.x.x` (below 2.3.68) | Session Manager not supported on this agent version. Sessions fail with `NotSupported` or silently. AGENT_OUTDATED. |\n| `AgentVersion: 3.0.x` below 3.0.196 | Port forwarding not supported. PORT_FORWARDING_FAILURE due to AGENT_OUTDATED. |\n| `PlatformName: Mac OS` + agent below 3.1.x | Session Manager not supported on macOS below 3.1. AGENT_OUTDATED. |\n\nIf input is malformed (missing InstanceId, absent symptom\ndescription, no document name for document errors), emit:\n\n```text\nTARGET: \u003Cinstance-id or unknown>\nVERDICT: INSUFFICIENT_DATA\nREASON: Input is missing required context — at minimum a symptom\n  description (error string or observed behaviour) and the\n  InstanceId, plus for document\u002Foutput errors the session document\n  name and the target S3 bucket or CloudWatch log group.\nLAYER: UNKNOWN\nEVIDENCE:\n  - Missing: \u003Clist specific missing fields>\nREMEDIATION: Re-prompt for: (1) the exact error string or observed\n  symptom, (2) the InstanceId and platform (Linux \u002F macOS \u002F\n  Windows), (3) the instance VPC and whether it has internet\n  access, and (4) for output\u002Faudit errors, the session document\n  name and the target S3 bucket \u002F CloudWatch log group.\n```\n\n## Process — Diagnostic decision tree (apply in symptom order)\n\nSymptom-driven. Pick the entry point based on the observed symptom,\nthen walk the layer-specific probes in order. **Never emit\nROOT_CAUSE_IDENTIFIED without a failing probe that matches the\nsymptom.**\n\n### Step 0: Non-obvious behaviours that change diagnosis\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#step-0-non-obvious-behaviours-that-change-diagnosis).\n> Three-endpoint rule, StartSession on the caller vs ssmmessages on the instance, AmazonEC2RoleforSSM deprecation, agent version floors and self-update via S3, document-carried audit config, shell-profile instant-close, hybrid activation expiry, patch associations slowing the data channel, macOS agent differences, stale Active sessions.\n\n### Step 1: Instance registration layer\n\nEntry: instance absent from Fleet Manager \u002F\n`describe-instance-information` returns empty for the instance.\n\n1. **Is the instance running and does it have an instance profile?**\n   ```bash\n   aws ec2 describe-instances --instance-ids \u003Ci-id> \\\n     --query 'Reservations[0].Instances[0].[State.Name,IamInstanceProfile.Arn]' --output text\n   ```\n   - State `stopped` → start the instance first.\n   - No instance profile ARN → the role is missing; attach one.\n     **INSTANCE_NOT_REGISTERED.**\n\n2. **Does the instance role include AmazonSSMManagedInstanceCore?**\n   ```bash\n   aws iam list-attached-role-policies --role-name \u003Crole-name> --output json\n   ```\n   - AmazonSSMManagedInstanceCore NOT attached → the agent cannot\n     call `ssm:UpdateInstanceInformation`. **INSTANCE_NOT_REGISTERED.**\n   - Legacy `AmazonEC2RoleforSSM` → deprecated; switch to\n     AmazonSSMManagedInstanceCore.\n\n3. **Can the agent reach the SSM endpoint?**\n   - Public subnet: route to IGW; agent reaches `ssm.\u003Cregion>.amazonaws.com`.\n   - Private subnet with NAT: route to NAT; agent reaches the\n     public SSM endpoint.\n   - Private subnet without NAT: needs `ssm`, `ec2messages`, and\n     `ssmmessages` interface VPC endpoints.\n   - VPC endpoint missing → agent never registers.\n     **INSTANCE_NOT_REGISTERED (network).**\n\n4. **Is the SSM Agent running on the instance?**\n   On the instance:\n   ```bash\n   sudo systemctl status amazon-ssm-agent          # Linux systemd\n   sudo launchctl list | grep amazon-ssm-agent     # macOS\n   Get-Service AmazonSSMAgent                       # Windows PowerShell\n   ```\n   - Agent not installed or stopped → install or start it.\n     **INSTANCE_NOT_REGISTERED.**\n\n5. **For hybrid (non-EC2) instances: is the activation valid?**\n   ```bash\n   aws ssm describe-activations --output json\n   ```\n   - `ExpiredDate` in the past or `RegistrationLimit` reached →\n     the agent cannot re-register after a restart.\n     **INSTANCE_NOT_REGISTERED (hybrid).**\n\nIf the instance is running, the role is correct, the agent is\ninstalled, but registration still fails, move to the VPC endpoint\nlayer (Step 5) — the agent may not be reaching `ssm.*`.\n\n### Step 2: IAM permission layer (instance role)\n\nEntry: session starts on the client then times out, or agent log\nshows `ssmmessages:OpenDataChannel AccessDenied`.\n\n```bash\naws iam simulate-principal-policy \\\n  --policy-source-arn \"\u003Cinstance-role-arn>\" \\\n  --action-names ssm:UpdateInstanceInformation \\\n    ssmmessages:CreateControlChannel ssmmessages:CreateDataChannel \\\n    ssmmessages:OpenControlChannel ssmmessages:OpenDataChannel \\\n    s3:PutObject logs:CreateLogStream \\\n  --output json\n```\n\n- Any action that returns `implicitDeny` or `explicitDeny` confirms\n  the role is missing the permission. **IAM_PERMISSION_MISSING.**\n- `ssmmessages:OpenDataChannel` denied → session times out within\n  seconds of starting on the client.\n- `s3:PutObject` on the session-output bucket denied → sessions\n  work but audit logs never land in S3. Cross-reference Step 7.\n- `logs:CreateLogStream` denied → sessions work but CloudWatch\n  Logs group stays empty. Cross-reference Step 9.\n\nFor the caller's role (the human or service invoking StartSession):\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-2--caller-role-probe).\n> simulate-principal-policy on the caller's role for ssm:StartSession \u002F ssm:TerminateSession scoped to the instance and SSM-SessionManagerRunShell document ARNs.\n- `ssm:StartSession` denied on the caller side → the CLI\u002FAPI call\n  returns `AccessDeniedException` immediately, before any session\n  is attempted. **IAM_PERMISSION_MISSING (caller).**\n\n### Step 3: VPC endpoint layer\n\nEntry: instance `Online` (registered) but session times out;\nprivate subnet with no internet egress.\n\n```bash\nVPC_ID=$(aws ec2 describe-instances --instance-ids \u003Ci-id> \\\n  --query 'Reservations[0].Instances[0].VpcId' --output text)\naws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=$VPC_ID \\\n  --query 'VpcEndpoints[?contains(ServiceName,`ssm`)].[ServiceName,State,VpcEndpointType]' --output table\n```\n\nRequired endpoints (interface type) for private-subnet SSM:\n\n| Endpoint service | Required for |\n|---|---|\n| `com.amazonaws.\u003Cregion>.ssm` | Control plane: registration, StartSession API |\n| `com.amazonaws.\u003Cregion>.ec2messages` | Run Command \u002F Association delivery |\n| `com.amazonaws.\u003Cregion>.ssmmessages` | Session data channel (the actual terminal stream) |\n\n- Missing `ssmmessages` → session times out within seconds. The\n  most common SSM session failure. **VPC_ENDPOINT_MISSING.**\n- Missing `ssm` → instance never registers (cross-reference Step 1).\n- Endpoint present but `State: Pending` \u002F `Failed` → the endpoint\n  is not yet usable; wait for `Available`.\n\nAlso check the endpoint security group: the VPC endpoint's SG\nmust allow 443 inbound from the instance's subnet\u002Feni. A VPC\nendpoint with no inbound rule on 443 is unreachable from the\ninstance.\n\n### Step 4: Session connection timeout layer\n\nEntry: session starts, then times out; VPC endpoints all present\nand IAM passes.\n\n1. **Security group egress on the instance.**\n   ```bash\n   aws ec2 describe-security-groups --group-ids \u003Csg-id> \\\n     --query 'SecurityGroups[0].IpPermissionsEgress' --output json\n   ```\n   - No egress on 443 to the VPC endpoint CIDRs or the service\n     ranges → the agent cannot reach `ssmmessages.*.amazonaws.com`.\n     **SESSION_CONNECTION_TIMEOUT.**\n\n2. **DNS resolution for the endpoint.**\n   - Interface VPC endpoints use private DNS by default. If private\n     DNS is disabled, the instance resolves `ssmmessages.*` to the\n     public IP and the session fails in a no-egress VPC.\n   - Check `describe-vpc-endpoints` for `PrivateDnsEnabled: true`.\n\n3. **Instance-side agent log.**\n   ```bash\n   tail -n 200 \u002Fvar\u002Flog\u002Famazon\u002Fssm\u002Famazon-ssm-agent.log | grep -iE \"session|ssmmessages|timeout\"\n   ```\n   - `dial tcp: i\u002Fo timeout` reaching `ssmmessages.*` → network\n     path broken. **SESSION_CONNECTION_TIMEOUT.**\n   - `403 Forbidden` on `ssmmessages:OpenDataChannel` → IAM (Step 2).\n\n### Step 5: Agent version layer\n\nEntry: port forwarding or session feature returns `NotSupported`;\nmacOS instance cannot start sessions.\n\n```bash\naws ssm describe-instance-information \\\n  --filters Key=InstanceIds,Values=\u003Ci-id> \\\n  --query 'InstanceInformationList[].AgentVersion' --output text\n```\n\n| Agent version | Session Manager | Port forwarding | macOS session |\n|---|---|---|---|\n| \u003C 2.3.68.0 | Not supported | Not supported | Not supported |\n| 2.3.68.0 – 2.3.x | Supported | Not supported | Not supported |\n| 3.0.196+ | Supported | Supported | Not supported |\n| 3.1.x+ | Supported | Supported | Supported |\n\n- Below 2.3.68 → sessions fail with `NotSupported` or silently.\n  **AGENT_OUTDATED.**\n- Below 3.0.196 → port forwarding returns `NotSupported`.\n  **AGENT_OUTDATED (port forwarding).**\n- macOS below 3.1 → session API errors. **AGENT_OUTDATED (macOS).**\n\nAgent self-update requires reaching `s3.*.amazonaws.com` or an S3\nVPC endpoint. A locked-down private subnet without an S3 endpoint\nstays on the old agent.\n\n### Step 6: Session document layer\n\nEntry: `InvalidDocument`, `InvalidDocumentVersion`, or document\nschema errors on session start.\n\n```bash\naws ssm get-document --name \u003Cdocument-name> --output json | jq '.'\naws ssm describe-document --name \u003Cdocument-name> --output json | jq '.'\n```\n\n- Document `Status: Failed` or `SchemaVersion` not `1.0` for a\n  session document → document error. **SESSION_DOCUMENT_ERROR.**\n- The default document `SSM-SessionManagerRunShell` should have\n  `DocumentType: Session`. If `DocumentType` is `Command` or the\n  schema is wrong, sessions fail. **SSM_DOCUMENT_ERROR.**\n- For a custom document, the schema must match the session document\n  schema (inputs for `s3BucketName`, `cloudWatchLogGroupName`,\n  `kmsKeyId`, `shellProfile`). Missing fields default to no output.\n- Document sharing: a session document must be shared with the\n  caller account if cross-account. Missing share →\n  `AccessDeniedException` on StartSession.\n\n### Step 7: Port forwarding layer\n\nEntry: port forwarding command connects but the forwarded port\ncannot reach the target.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-7--port-forwarding-probe).\n> start-session --document-name AWS-StartPortForwardingSession with portNumber\u002FhostName parameters.\n\n1. **Document name.** The default port-forwarding document is\n   `AWS-StartPortForwardingSession` (managed). A custom document\n   must be `Session` type and use the port-forwarding schema.\n2. **Target host reachability.** The `hostName` is resolved from\n   the INSTANCE, not the caller. If the instance cannot route to\n   `hostName` (different VPC, SG block), the forwarded port\n   connects to nothing. **PORT_FORWARDING_FAILURE.**\n3. **Agent version.** Port forwarding requires agent >= 3.0.196.\n   Below → `NotSupported`. **AGENT_OUTDATED.**\n\n### Step 8: Shell profile layer\n\nEntry: session opens and closes immediately; agent log shows\n`SessionTypeHandler` errors.\n\n```bash\n# On the instance, tail the agent log\ntail -n 200 \u002Fvar\u002Flog\u002Famazon\u002Fssm\u002Famazon-ssm-agent.log | grep -iE \"SessionTypeHandler|shell|profile\"\n```\n\n- `.bashrc` with an `exit` \u002F `logout` → session closes immediately.\n  **SHELL_PROFILE_ERROR.**\n- `.bash_profile` syntax error → session fails to spawn the shell.\n  **SHELL_PROFILE_ERROR.**\n- Custom `shellProfile` in the session document pointing to a\n  non-existent binary → session opens, exits.\n  **SHELL_PROFILE_ERROR.**\n\n### Step 9: Audit log \u002F session output to S3 layer\n\nEntry: sessions work but no JSON output in the S3 session bucket.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-9--audit-log--s3-output-probe).\n> get-document s3BucketName\u002Fs3KeyPrefix, get-bucket-policy, head-bucket on the session-output bucket.\n\n- Document `s3BucketName` empty → no S3 output configured. Add the\n  bucket name in the document. **AUDIT_LOG_S3_MISSING.**\n- Bucket policy missing the grant for\n  `arn:aws:iam::\u003Caccount>:role\u002F\u003Cinstance-role>` `s3:PutObject` on\n  `arn:aws:s3:::\u003Cbucket>\u002F\u003Cprefix>\u002F*` → the agent writes but S3\n  rejects. **AUDIT_LOG_S3_MISSING.**\n- Bucket Region vs document Region mismatch → the agent writes to\n  the wrong Region endpoint.\n- SSE-KMS bucket where the role lacks `kms:GenerateDataKey` → write\n  fails. **SESSION_RECORDING_S3.**\n\nFor session recording (shell scrollback), the same bucket and a\nlonger `s3KeyPrefix` apply. If scrollback is truncated, check the\ndocument's `cloudWatchLogGroupName` (separate stream) and the\nrecording-enabled flag.\n\n### Step 10: CloudWatch Logs delivery layer\n\nEntry: sessions work but the CloudWatch Logs group is empty.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-10--cloudwatch-logs-delivery-probe).\n> get-document cloudWatchLogGroupName\u002FcloudWatchStreamingEnabled, describe-log-groups, role logs:CreateLogStream\u002FPutLogEvents simulation.\n\n- Document `cloudWatchLogGroupName` empty → no CW Logs output\n  configured. **CLOUDWATCH_LOGS_MISSING.**\n- Role missing `logs:CreateLogStream` \u002F `logs:PutLogEvents` → agent\n  cannot write. **CLOUDWATCH_LOGS_MISSING.**\n- Log group in a different account without resource-policy grant\n  to the SSM service → writes denied.\n\n### Step 11: Patch baseline blocking layer\n\nEntry: sessions fail during a maintenance window; `ScanOnly` or\n`Install` association in `Running` state.\n\n> Moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md#step-11--patch-baseline-association-probe).\n> describe-instance-associations-status and describe-association to detect a Running ScanOnly\u002FInstall association during the session failure window.\n\n- Association `Status: Running` during a patch window → agent busy;\n  session data channel may be slow to open. Rare; usually resolves\n  when the patch completes. **PATCH_BASELINE_BLOCKING.**\n- If the association is `Failed`, the patch itself errored; sessions\n  are unaffected. Different root cause.\n\n### Step 12: INSUFFICIENT_DATA — when none of the layers confirm\n\nIf every probe passes and no failing probe matches the symptom,\nemit INSUFFICIENT_DATA. List the passing probes in EVIDENCE.\nRecommend escalation to AWS Support with the instance id, session\nid, and the failing probe outputs.\n\n## Output specification — diagnostic block\n\n```text\nTARGET: \u003Cinstance-id with session\u002Fdocument context>\nVERDICT: ROOT_CAUSE_IDENTIFIED | INSUFFICIENT_DATA\nREASON: \u003C1-3 sentences naming the failed layer and the failing probe>\nLAYER: \u003CINSTANCE_NOT_REGISTERED | SESSION_CONNECTION_TIMEOUT |\n        AGENT_OUTDATED | IAM_PERMISSION_MISSING |\n        VPC_ENDPOINT_MISSING | SESSION_DOCUMENT_ERROR |\n        PORT_FORWARDING_FAILURE | SHELL_PROFILE_ERROR |\n        AUDIT_LOG_S3_MISSING | SESSION_RECORDING_S3 |\n        CLOUDWATCH_LOGS_MISSING | PATCH_BASELINE_BLOCKING |\n        SSM_DOCUMENT_ERROR | UNKNOWN>\nEVIDENCE:\n  - \u003Cobserved symptom — error string or behaviour>\n  - \u003Cfailing probe — command and its output that confirms the cause>\n  - \u003Cpassing probes — layers ruled out>\nREMEDIATION:\n  1. \u003Cspecific action with CLI command or API call>\n  2. \u003Cverification command after the fix>\n```\n\nField rules:\n\n- `TARGET` includes the instance id and, when applicable, the\n  session document name and session id.\n- `VERDICT` is one of the two enumerated values.\n- `EVIDENCE` always includes (a) symptom, (b) failing probe output,\n  (c) at least one passing probe ruling out a competing layer.\n\n## Pre-flight safety checks (run before any state-changing CLI)\n\n- **MANDATORY CONFIRMATION GATE.** Before any state-changing\n  operation (`start-session`, `terminate-session`, `put-document`,\n  `update-document`, `create-vpc-endpoint`, `attach-role-policy`,\n  `put-bucket-policy`), emit and await operator approval.\n- **Read-only first.** Every probe in the diagnostic tree is\n  read-only. Do not perform state-changing operations as probes.\n- **`terminate-session`** closes a live session the operator may be\n  using. Confirm before terminating; check `describe-sessions\n  --state Active` first.\n- **`update-document` on SSM-SessionManagerRunShell** affects every\n  session using the default document. Use a custom document for\n  testing changes before applying to the default.\n- **`create-vpc-endpoint`** is billed hourly; confirm the endpoint\n  is needed before creating. The three SSM endpoints (~$0.01\u002Fhour\n  each in us-east-1) are cheap but accrue.\n- **Role policy changes** affect every instance using that role.\n  Use a test role on a test instance before applying to production.\n\n## Remediation guidance\n\n> Moved to [references\u002Ferror-handling.md](references\u002Ferror-handling.md#remediation-guidance).\n> Per-layer fix CLIs: associate-iam-instance-profile + Core policy + agent start (INSTANCE_NOT_REGISTERED), ssmmessages inline policy (IAM), create-vpc-endpoint ssmmessages, SG egress + private DNS (TIMEOUT), agent update commands per OS, document reset (DOCUMENT), port-forwarding checks, shell profile fixes, S3 bucket policy + kms:GenerateDataKey, CloudWatch Logs config, patch-window reschedule.\n\n## Deep reference\n\n### Symptom → layer decision matrix\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#symptom--layer-decision-matrix).\n> 12-row error-string\u002Fbehaviour -> LAYER decision matrix (instance absent, ConnectionLost, ChannelClosedException, AccessDeniedException caller vs agent log, NotSupported, InvalidDocument, instant close, empty bucket\u002Flogs, macOS).\n\n### Session document schema (SSM-SessionManagerRunShell)\n\n> Moved to [references\u002Fsession-output-and-document-reference.md](references\u002Fsession-output-and-document-reference.md#session-document-schema-ssm-sessionmanagerrunshell).\n> Full JSON schema of the default session document: s3BucketName\u002Fs3KeyPrefix\u002Fs3EncryptionEnabled, cloudWatchLogGroupName\u002FcloudWatchStreamingEnabled, kmsKeyId, runAs*, shellProfile; empty output fields disable audit paths.\n\n## Recent AWS features (2024-2026)\n\n> Moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md#recent-aws-features-2024-2026).\n> CloudWatch streaming semantics, AWS-StartPortForwardingSessionToRemoteHost, macOS 3.1.x session support, scrollback recording, VPC endpoint resource policies.\n\n## References (load on demand)\n\n- [advanced-patterns](references\u002Fadvanced-patterns.md) — Mindset, Philosophy (control vs data plane), quick-start coverage rules, Step 0 non-obvious behaviours, symptom-to-layer decision matrix, Recent AWS features\n- [diagnostic-commands](references\u002Fdiagnostic-commands.md) — pre-flight probes, the Step 2 caller-role probe, and the Step 7\u002F9\u002F10\u002F11 per-layer probe commands moved from SKILL.md\n- [error-handling](references\u002Ferror-handling.md) — per-layer remediation fix commands moved from SKILL.md\n- [session-output-and-document-reference](references\u002Fsession-output-and-document-reference.md) — session document schema, audit-log bucket policies, CloudWatch Logs delivery, shell profiles, port-forwarding document variants\n- [vpc-endpoint-and-iam-reference](references\u002Fvpc-endpoint-and-iam-reference.md) — three-endpoint matrix, instance-role and caller-role permission maps, agent version support matrix\n\n## Domain\n\nAWS CloudOps \u002F Systems Manager Session Manager, Instance\nRegistration Diagnostics, VPC Endpoint Configuration, IAM Role\nPermissions, Session Output and Audit Log Delivery, Port\nForwarding, and Shell Profile Management.\n\n## AWS documentation\n\n- **AWS Systems Manager Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager.html\n- **Setting up Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-getting-started.html\n- **Working with Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-working-with-sessions.html\n- **Troubleshooting Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-troubleshooting.html\n- **VPC endpoints for Systems Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsetup-create-vpc.html\n- **AmazonSSMManagedInstanceCore policy** — https:\u002F\u002Fdocs.aws.amazon.com\u002Faws-managed-policy\u002Flatest\u002Freference\u002FAmazonSSMManagedInstanceCore.html\n- **SSM Agent version history** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fssm-agent.html\n- **Session Manager auditing** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-auditing.html\n- **Port forwarding with Session Manager** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fsystems-manager\u002Flatest\u002Fuserguide\u002Fsession-manager-working-with-sessions-port-forwarding.html\n- **AWS Health** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fhealth\u002Flatest\u002Fug\u002F\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":44},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"task_type":32,"complexity":33,"entry_point":34,"skill_class":35,"when_to_use":36,"requires_llm":37,"verdict_shape":38,"when_not_to_use":39,"lifecycle_status":40,"invocation_schema":41,"supports_pipeline":37,"invocation_example":42,"activation_triggers":43},"ssm, management, troubleshooting, session-manager, vpc-endpoint, iam-role, port-forwarding, session-recording, audit-logs","2","Jacky Chan — AWS Community Builder","aws-cloudops","Management","0.1.0","SSM, Session Manager, ssm:StartSession, SSM Agent, AmazonSSMManagedInstanceCore, VPC endpoint, ssmmessages, ec2messages, port forwarding, shell profile, session recording, S3 audit logs, CloudWatch Logs, hybrid enrollment, activation code, patch baseline, SSM Document, troubleshooting","troubleshoot","high","false","capability","Diagnosing an SSM Session Manager failure (managed instance not showing in the console, session connection timeout, port forwarding failure, \"is not registered to the account or role\" error, missing audit logs in S3, missing CloudWatch Logs, session recording failure, shell profile error, patch-baseline-blocked session, SSM Document error, agent version too old for session features), walking a symptom to the failed layer with verify and fix commands, validating why a session cannot start or connect, or triaging a \"Session Manager is broken\" page where the root cause may be agent, IAM role, VPC endpoint, document, shell profile, or audit-log config — not necessarily the SSM service itself.","true","ROOT_CAUSE_IDENTIFIED | INSUFFICIENT_DATA","SSM Run Command \u002F Automation execution debugging (use ssm-automation-deployer or a run-command skill), EC2 instance reachability at the OS level (use ec2-instance-reachability checks), patch compliance posture audits (use ssm-patch-compliance-automator), or IAM policy authoring for the instance role (use iam-least-privilege-advisor). This skill diagnoses Session Manager connectivity and session-output failures; it does not audit patch baseline posture or debug Run Command document execution.","active","Input: either (a) a symptom description (error message, observed behaviour, \"session times out after 10s\", \"instance not in the console\"), optionally paired with the instance configuration (describe-instance-information output) and recent SSM \u002F CloudWatch logs, OR (b) an InstanceId plus session context (document name, session id, target host for port forwarding, VPC endpoint config) for live-account diagnosis. Output: a deterministic TARGET\u002FVERDICT\u002FREASON\u002FLAYER\u002FEVIDENCE\u002FREMEDIATION block where VERDICT ∈ {ROOT_CAUSE_IDENTIFIED, INSUFFICIENT_DATA} and LAYER ∈ {INSTANCE_NOT_REGISTERED, SESSION_CONNECTION_TIMEOUT, AGENT_OUTDATED, IAM_PERMISSION_MISSING, VPC_ENDPOINT_MISSING, SESSION_DOCUMENT_ERROR, PORT_FORWARDING_FAILURE, SHELL_PROFILE_ERROR, AUDIT_LOG_S3_MISSING, SESSION_RECORDING_S3, CLOUDWATCH_LOGS_MISSING, PATCH_BASELINE_BLOCKING, SSM_DOCUMENT_ERROR, UNKNOWN}.","# Minimal valid input (offline symptom classification):\nSymptom: \"EC2 instance i-0abcdef1234567890 in a private subnet does\nnot appear in the SSM Fleet Manager console. The instance\nhas the AmazonSSMManagedInstanceCore role attached but is\nin a VPC with no ssmmessages VPC endpoint. Sessions started\nfrom other instances in a public subnet work fine.\"\nInstanceId: i-0abcdef1234567890\nVPC: vpc-priv (no internet gateway, no NAT gateway)\nInstanceRole: EC2-SSM-Role (AmazonSSMManagedInstanceCore attached)\nVPC endpoints configured: ssm (interface), ec2messages (interface)\nVPC endpoints MISSING: ssmmessages\nLast log line: \"Session Manager connection timed out\"","SSM Session Manager connection failed, SSM session timeout, managed instance not showing up, instance not registered SSM, SSM Agent not running, ssm:StartSession denied, SSM port forwarding failed, channel closed Session Manager, ssmmessages endpoint, VPC endpoint SSM missing, SSM session recording S3, SSM audit logs missing, SessionManagerRunShell, SSM Document error, SSM agent version outdated, hybrid activation expired, patch baseline blocking session, troubleshoot SSM Session Manager","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline symptom classification works from pasted error messages and instance configuration. Live-account diagnosis uses aws ssm describe-instance-information, describe-sessions, get-document, describe-instance-properties, aws ec2 describe-instances \u002F describe-vpc-endpoints \u002F describe-security-groups, aws iam simulate-principal-policy on the instance role, aws logs describe-log-groups \u002F filter-log-events, aws...","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fssm-session-troubleshooter",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill ssm-session-troubleshooter",{"tool":59,"command":60},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill ssm-session-troubleshooter",{"tool":62,"command":63},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill ssm-session-troubleshooter","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002FSKILL.md",true,[67,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",13938,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Feval\u002Ftest-cases.yaml",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"evals\u002Fbaselines\u002Fagent-outdated-port-forwarding-fails.md",431,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fbaselines\u002Fagent-outdated-port-forwarding-fails.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fbaselines\u002Fiam-role-missing-ssmmessages-permissions.md",511,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fbaselines\u002Fiam-role-missing-ssmmessages-permissions.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"evals\u002Fbaselines\u002Finstance-not-registered-agent-stopped.md",470,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fbaselines\u002Finstance-not-registered-agent-stopped.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"evals\u002Fbaselines\u002Fsession-document-s3-bucket-empty.md",507,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fbaselines\u002Fsession-document-s3-bucket-empty.md",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"evals\u002Fbaselines\u002Fvpc-endpoint-ssmmessages-missing.md",451,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fbaselines\u002Fvpc-endpoint-ssmmessages-missing.md",{"path":94,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":95,"sourceHtmlUrl":96},"evals\u002Feval_config.yaml",2144,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Feval_config.yaml",{"path":98,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":99,"sourceHtmlUrl":100},"evals\u002Fevals.json",5252,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fevals.json",{"path":102,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":103,"sourceHtmlUrl":104},"evals\u002Fprompts\u002Fagent-outdated-port-forwarding-fails.md",1574,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fprompts\u002Fagent-outdated-port-forwarding-fails.md",{"path":106,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":107,"sourceHtmlUrl":108},"evals\u002Fprompts\u002Fiam-role-missing-ssmmessages-permissions.md",1950,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fprompts\u002Fiam-role-missing-ssmmessages-permissions.md",{"path":110,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":111,"sourceHtmlUrl":112},"evals\u002Fprompts\u002Finstance-not-registered-agent-stopped.md",1609,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fprompts\u002Finstance-not-registered-agent-stopped.md",{"path":114,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":115,"sourceHtmlUrl":116},"evals\u002Fprompts\u002Fsession-document-s3-bucket-empty.md",1931,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fprompts\u002Fsession-document-s3-bucket-empty.md",{"path":118,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":119,"sourceHtmlUrl":120},"evals\u002Fprompts\u002Fvpc-endpoint-ssmmessages-missing.md",2080,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fevals\u002Fprompts\u002Fvpc-endpoint-ssmmessages-missing.md",{"path":122,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":123,"sourceHtmlUrl":124},"examples\u002FREADME.md",7777,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fexamples\u002FREADME.md",{"path":126,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":127,"sourceHtmlUrl":128},"references\u002Fadvanced-patterns.md",10224,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Freferences\u002Fadvanced-patterns.md",{"path":130,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":131,"sourceHtmlUrl":132},"references\u002Fdiagnostic-commands.md",3920,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Freferences\u002Fdiagnostic-commands.md",{"path":134,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":135,"sourceHtmlUrl":136},"references\u002Ferror-handling.md",4434,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Freferences\u002Ferror-handling.md",{"path":138,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":139,"sourceHtmlUrl":140},"references\u002Fsession-output-and-document-reference.md",8233,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Freferences\u002Fsession-output-and-document-reference.md",{"path":142,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":143,"sourceHtmlUrl":144},"references\u002Fvpc-endpoint-and-iam-reference.md",6015,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Freferences\u002Fvpc-endpoint-and-iam-reference.md",{"path":146,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":147,"sourceHtmlUrl":148},"skill.usf.yaml",4640,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fssm-session-troubleshooter\u002Fskill.usf.yaml",[150,157,164,171,178,185],{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","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 \u002F method \u002F 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 \u002F 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 \u002F EKS \u002F 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","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 \u002F 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","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\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":179,"name":180,"nameZh":6,"description":181,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":182,"categories":183,"keywords":184,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","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\u002Fbypass 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]