ECS Anywhere Diagnostics
When to use
Any ECS Anywhere investigation — external instance registration, SSM agent issues, task placement failures, container runtime errors, networking, service discovery, IAM roles, credential management, monitoring, log collection, or capacity provider configuration.
Investigation workflow
Step 1 — Collect and triage
aws ecs list-container-instances --cluster <cluster-name> --filter "attribute:ecs.os-type == linux" --status ACTIVE
aws ecs describe-container-instances --cluster <cluster-name> --container-instances <instance-arn> --query 'containerInstances[*].{Id:ec2InstanceId,Status:status,Agent:agentConnected,RunningTasks:runningTasksCount}'
aws ssm describe-instance-information --filters Key=ResourceType,Values=ManagedInstance --query 'InstanceInformationList[*].{Id:InstanceId,PingStatus:PingStatus,Platform:PlatformName}'
Step 2 — Domain deep dive
aws ecs describe-tasks --cluster <cluster-name> --tasks <task-arn> --query 'tasks[*].{Status:lastStatus,StoppedReason:stoppedReason,Containers:containers[*].{Name:name,Status:lastStatus,ExitCode:exitCode}}'
aws ssm get-connection-status --target <managed-instance-id>
aws ecs describe-services --cluster <cluster-name> --services <service-name> --query 'services[*].{Status:status,DesiredCount:desiredCount,RunningCount:runningCount,Events:events[:5]}'
Step 3 — Detailed investigation
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventSource,AttributeValue=ecs.amazonaws.com --max-results 20
aws logs filter-log-events --log-group-name /ecs/<cluster-name> --start-time <epoch-ms> --filter-pattern "ERROR"
aws ecs describe-capacity-providers --capacity-providers <provider-name>
Read references/guardrails.md before concluding on any ECS Anywhere issue.
Tool quick reference
| Tool / API |
When to use |
ecs list-container-instances |
List registered external instances |
ecs describe-container-instances |
Get instance details and status |
ssm describe-instance-information |
Check SSM agent connectivity |
ecs describe-tasks |
Get task status and stopped reasons |
ecs describe-services |
Get service status and events |
ssm get-connection-status |
Check SSM connection for an instance |
ecs describe-capacity-providers |
Get capacity provider configuration |
Gotchas: ECS Anywhere
- External instances register as EXTERNAL launch type, not EC2 or FARGATE. Task definitions must specify EXTERNAL as a compatible launch type.
- SSM Agent is REQUIRED on all external instances. It handles registration, credential rotation, and communication with AWS. If SSM Agent stops, the instance becomes disconnected.
- External instances use SSM managed instances (mi-) not EC2 instances (i-). The instance ID format is different.
- ECS Agent on external instances gets temporary credentials via SSM. Credential rotation happens automatically but requires SSM Agent to be running.
- Networking on external instances uses the host network mode or bridge mode. awsvpc mode is NOT supported on external instances.
- Service discovery with Cloud Map works but requires the external instance to have network connectivity to the discovered endpoints.
- External instances do NOT support GPU task placement, Elastic Inference, or EFS volumes.
Anti-hallucination rules
- Always cite specific instance ARNs, task ARNs, or SSM instance IDs as evidence.
- EXTERNAL launch type is distinct from EC2 and FARGATE. Never conflate them.
- SSM Agent is mandatory for ECS Anywhere. Never suggest alternatives.
- awsvpc network mode is NOT supported on external instances. Never recommend it.
- Spend no more than 2 minutes on any single hypothesis. Pivot if inconclusive.
12 runbooks
| Category |
IDs |
Covers |
| A — Registration |
A1-A2 |
External instance registration, SSM agent issues |
| B — Task Execution |
B1-B2 |
Task placement failures, container runtime errors |
| C — Networking |
C1-C2 |
Networking issues, service discovery |
| D — IAM & Credentials |
D1-D2 |
IAM role configuration, credential management |
| E — Observability |
E1-E2 |
Monitoring gaps, log collection |
| F — Capacity |
F1 |
Capacity provider |
| Z — Catch-All |
Z1 |
General troubleshooting |
1---2name: ecs-anywhere-diagnostics3description: Use this skill to investigate and troubleshoot ECS Anywhere problems by analyzing external instance registration, SSM agent issues, task placement failures, container runtime errors, networking, service discovery, IAM roles, credential management, monitoring, log collection, capacity providers, and following structured runbooks. Activate when: external instance registration failures, SSM agent issues, task placement errors, container runtime problems, networking issues, service discovery failures, IAM configuration errors, credential problems, monitoring gaps, log collection issues, capacity provider errors, or the user says something is wrong with ECS Anywhere.4---56# ECS Anywhere Diagnostics78## When to use910Any ECS Anywhere investigation — external instance registration, SSM agent issues, task placement failures, container runtime errors, networking, service discovery, IAM roles, credential management, monitoring, log collection, or capacity provider configuration.1112## Investigation workflow1314### Step 1 — Collect and triage1516```17aws ecs list-container-instances --cluster <cluster-name> --filter "attribute:ecs.os-type == linux" --status ACTIVE18aws ecs describe-container-instances --cluster <cluster-name> --container-instances <instance-arn> --query 'containerInstances[*].{Id:ec2InstanceId,Status:status,Agent:agentConnected,RunningTasks:runningTasksCount}'19aws ssm describe-instance-information --filters Key=ResourceType,Values=ManagedInstance --query 'InstanceInformationList[*].{Id:InstanceId,PingStatus:PingStatus,Platform:PlatformName}'20```2122### Step 2 — Domain deep dive2324```25aws ecs describe-tasks --cluster <cluster-name> --tasks <task-arn> --query 'tasks[*].{Status:lastStatus,StoppedReason:stoppedReason,Containers:containers[*].{Name:name,Status:lastStatus,ExitCode:exitCode}}'26aws ssm get-connection-status --target <managed-instance-id>27aws ecs describe-services --cluster <cluster-name> --services <service-name> --query 'services[*].{Status:status,DesiredCount:desiredCount,RunningCount:runningCount,Events:events[:5]}'28```2930### Step 3 — Detailed investigation3132```33aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventSource,AttributeValue=ecs.amazonaws.com --max-results 2034aws logs filter-log-events --log-group-name /ecs/<cluster-name> --start-time <epoch-ms> --filter-pattern "ERROR"35aws ecs describe-capacity-providers --capacity-providers <provider-name>36```3738Read `references/guardrails.md` before concluding on any ECS Anywhere issue.3940## Tool quick reference4142| Tool / API | When to use |43|------------|-------------|44| `ecs list-container-instances` | List registered external instances |45| `ecs describe-container-instances` | Get instance details and status |46| `ssm describe-instance-information` | Check SSM agent connectivity |47| `ecs describe-tasks` | Get task status and stopped reasons |48| `ecs describe-services` | Get service status and events |49| `ssm get-connection-status` | Check SSM connection for an instance |50| `ecs describe-capacity-providers` | Get capacity provider configuration |5152## Gotchas: ECS Anywhere5354- External instances register as EXTERNAL launch type, not EC2 or FARGATE. Task definitions must specify EXTERNAL as a compatible launch type.55- SSM Agent is REQUIRED on all external instances. It handles registration, credential rotation, and communication with AWS. If SSM Agent stops, the instance becomes disconnected.56- External instances use SSM managed instances (mi-*) not EC2 instances (i-*). The instance ID format is different.57- ECS Agent on external instances gets temporary credentials via SSM. Credential rotation happens automatically but requires SSM Agent to be running.58- Networking on external instances uses the host network mode or bridge mode. awsvpc mode is NOT supported on external instances.59- Service discovery with Cloud Map works but requires the external instance to have network connectivity to the discovered endpoints.60- External instances do NOT support GPU task placement, Elastic Inference, or EFS volumes.6162## Anti-hallucination rules63641. Always cite specific instance ARNs, task ARNs, or SSM instance IDs as evidence.652. EXTERNAL launch type is distinct from EC2 and FARGATE. Never conflate them.663. SSM Agent is mandatory for ECS Anywhere. Never suggest alternatives.674. awsvpc network mode is NOT supported on external instances. Never recommend it.685. Spend no more than 2 minutes on any single hypothesis. Pivot if inconclusive.6970## 12 runbooks7172| Category | IDs | Covers |73|----------|-----|--------|74| A — Registration | A1-A2 | External instance registration, SSM agent issues |75| B — Task Execution | B1-B2 | Task placement failures, container runtime errors |76| C — Networking | C1-C2 | Networking issues, service discovery |77| D — IAM & Credentials | D1-D2 | IAM role configuration, credential management |78| E — Observability | E1-E2 | Monitoring gaps, log collection |79| F — Capacity | F1 | Capacity provider |80| Z — Catch-All | Z1 | General troubleshooting |