---
title: "ECS placement error AGENT: the container agent is disconnected | Proofline"
description: "Read agentConnected, status and the agent version for every container instance in the cluster. One disconnected instance points at that host's agent."
url: https://proofline.sh/learn/ecs-container-instance-agent-disconnected/
---

[Learning center](/learn/)

# ECS placement error AGENT: the container agent is disconnected

Read agentConnected, status and the agent version for every container instance in the cluster. One disconnected instance points at that host's agent. Every instance disconnected at once points at something they share, such as the network path to ECS or the instance role.

Capacity overruns The Proofline team November 22, 2026 6 min read

## The signature

On the EC2 launch type, a deployment stalls and the service events say:

`service (service-name) was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id encountered error "AGENT".`

The ECS container agent on that instance is disconnected. Only instances with a connected agent can accept task placement requests, so ECS skips the instance even when it has free CPU and memory. The cause can also appear without this exact text. AWS lists a disconnected agent as a common cause of the `SERVICE_TASK_PLACEMENT_FAILURE` service action event, beside a lack of CPU or memory. A task already assigned to an instance can also stay `PENDING`, the state in which ECS waits on the container agent, and the instance's `pendingTasksCount` counts it. [Service event messages](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html) · [ContainerInstance agentConnected](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerInstance.html) · [Service action events](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_service_events.html) · [Task lifecycle](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-lifecycle-explanation.html)

A brief disconnect is normal. AWS says the agent disconnects and reconnects several times per hour as part of normal operation, so a single connection change in EventBridge is not a fault. A disconnect that lasts through repeated placement attempts is. [Container instance state change events](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_container_instance_events.html)

## Read every instance's agent state

Use a read-only profile and replace the uppercase placeholders. List the instances, then describe them with their health included.

```
aws ecs list-container-instances \
  --profile PROFILE --region REGION --cluster CLUSTER \
  --query 'containerInstanceArns' --output json --no-cli-pager

aws ecs describe-container-instances \
  --profile PROFILE --region REGION --cluster CLUSTER \
  --container-instances CONTAINER_INSTANCE_ARN_1 CONTAINER_INSTANCE_ARN_2 \
  --include CONTAINER_INSTANCE_HEALTH \
  --query 'containerInstances[].{ec2:ec2InstanceId,status:status,reason:statusReason,agent:agentConnected,version:versionInfo.agentVersion,update:agentUpdateStatus,running:runningTasksCount,pending:pendingTasksCount,health:healthStatus.overallStatus,checks:healthStatus.details[].{type:type,status:status,since:lastStatusChange}}' \
  --output json --no-cli-pager
```

The fields answer different questions:

-   `agentConnected` is false for an instance whose agent may be unhealthy or stopped.
-   `status` is the registration state. Only `ACTIVE` accepts tasks; `DRAINING` takes no new tasks by design, and `REGISTRATION_FAILED` comes with a `statusReason`.
-   `versionInfo.agentVersion` and `agentUpdateStatus` show the agent release and whether its last update `FAILED`.
-   `healthStatus`, returned only with `CONTAINER_INSTANCE_HEALTH`, reports checks run by agent 1.57.0 or later. Its overall status is `OK`, `IMPAIRED`, `INSUFFICIENT_DATA` or `INITIALIZING`, and the check types include `CONTAINER_RUNTIME` and `AGENT_CONNECTIVITY`.

[ContainerInstance fields](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerInstance.html) · [Container instance health](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-health.html) · [describe-container-instances](https://docs.aws.amazon.com/cli/latest/reference/ecs/describe-container-instances.html)

Match the disconnected instances' EC2 IDs with the EC2 or Auto Scaling view. A terminated instance whose agent was disconnected is not deregistered automatically, so it can stay in the list as a container instance that never reconnects. [Deregistering container instances](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deregister_container_instance.html)

## What the pattern means

| Pattern | Likely cause | Next check |
| --- | --- | --- |
| One instance `agent` false, others true | That host's agent stopped or is unhealthy, or the host itself is impaired | The agent log on that host; `CONTAINER_RUNTIME` health |
| Every instance false at about the same time | A shared dependency: the network path to ECS, DNS for VPC endpoints, or the instance role | Route tables, endpoint security groups and the role, around the time it started |
| `agent` false; the EC2 instance no longer exists | A stale registration | Deregister the record; it does not hold tasks |
| `agent` true; `status` `DRAINING` or `REGISTRATION_FAILED` | Not an agent problem | Who drained the instance, or the `statusReason` |
| `agent` true; `update` `FAILED` or an old `version` | The agent runs but lacks a feature the task needs | Placement fails on a missing attribute instead; update the agent or replace the instance |

The agent needs a container instance IAM role so ECS knows the agent belongs to your account. Without an internet path, it reaches ECS through the `ecs-agent`, `ecs-telemetry` and `ecs` interface endpoints, which must be in the same Region and whose security group must allow inbound TCP 443 from the instances' subnets. Using these endpoints with EC2 tasks requires agent 1.25.1 or later, and instances running before the endpoints were created must reboot or restart the agent to use them. [Container instance role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html) · [ECS interface endpoints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/vpc-endpoints.html)

## Look at the host

For a single disconnected instance, connect to it with your usual access method and read the agent log. For agent 1.36.0 and later on Linux, the log is at `/var/log/ecs/ecs-agent.log`, rotated hourly and kept for 24 hours by default. Read the entries around the time the instance stopped accepting tasks for authentication, connection or Docker errors. [Agent logs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/logs.html)

These commands change the host. On the Amazon ECS-optimized Amazon Linux 2 AMI, AWS suggests restarting the agent with `sudo systemctl restart ecs`. Restarting does not fix a cause outside the host, and for an instance in an Auto Scaling group, replacing it with a fresh launch is often quicker than repairing it. [Service event messages](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html)

## An illustrative fixture

This fixture is fictional. The cluster `checkout` has three container instances. A deployment of `checkout:42` starts at 14:00 and its tasks do not place.

In the first case `i-0a1` reads `agent` false, `version` 1.82.0, `health` `IMPAIRED` with the `CONTAINER_RUNTIME` check failing since 13:41. The other two read `agent` true and have no room left for the new tasks. ECS would have used `i-0a1`, which holds no tasks, but cannot. The agent log on `i-0a1` shows the agent losing its connection to Docker. Replace `i-0a1`, and the deployment places on the new instance.

In the second case all three read `agent` false from 13:52, the same minute a network change removed the private subnet's route to a NAT gateway. The cluster has no ECS interface endpoints, so the agents have no path to ECS. Restarting agents changes nothing. Restore the route or create the three endpoints, then confirm that `agent` returns to true on each instance.

## Confirm on the replacement

After the change, every `ACTIVE` instance should read `agent` true and an `OK` overall health, and the service events should stop naming error `AGENT`. Check that new tasks reach `RUNNING` with a `containerInstanceArn` on the repaired or replaced instances, and that the service reports a steady state. [Service event messages](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html)

## Where the reading misleads

`agentConnected` is a current value. An agent that reconnected after you noticed the failure reads true, so keep the `ECS Container Instance State Change` events or the service events from the incident window as the record. An `IMPAIRED` health status is ECS's view from the agent's checks; it names the failing check type, not the root cause on the host.

A disconnected agent and a full cluster can both end in a placement failure. When the event names insufficient CPU or memory but the numbers show free resources on some instance, check that instance's `agentConnected` before adding capacity, because a disconnected instance takes no tasks whatever it has free. See [the CPU and memory guide](/learn/ecs-unable-to-place-task-insufficient-resources/), [tasks stuck in PROVISIONING](/learn/ecs-capacity-provider-tasks-stuck-provisioning/) for instances that never registered, and [the signature table](/learn/aws-deployment-failure-signatures/) for other layers.

## Questions

### What does error AGENT mean in an ECS placement event?

The ECS container agent on the closest matching container instance is disconnected, so ECS cannot place tasks there. Read that instance's `agentConnected`, `status` and agent log.

### Is it normal for the ECS agent to disconnect?

Yes, briefly. AWS says the agent disconnects and reconnects several times per hour as part of normal operation. A disconnect that keeps an instance unavailable through repeated placement attempts is a fault.

### Why are all my ECS container instances disconnected at once?

When every agent drops together, look for what they share: a route or NAT change, missing or misconfigured ECS interface endpoints, DNS for those endpoints, or the container instance role. Restarting each agent does not fix a shared cause.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [ECS tasks stuck in PROVISIONING with a capacity provider](/learn/ecs-capacity-provider-tasks-stuck-provisioning/)
    
    Capacity overruns The Proofline team November 22, 2026 7 min read
    
-   ### [ECS unable to place a task: insufficient CPU or memory on EC2](/learn/ecs-unable-to-place-task-insufficient-resources/)
    
    Capacity overruns The Proofline team November 22, 2026 6 min read
