Solution skill
aws ecs execute-command fails with TargetNotConnectedException
Complete solution
Shows how to fix aws ecs execute-command fails with TargetNotConnectedException. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
What was reported: Issue aws/aws-cli#9070 (closed, 15 comments): ### Describe the bug I am unable to use ecs execute-command to connect to my ecs fargate task ### Regression Issue - [X] Select this option if this issue appears to be a regression. ### Expected Behavior I should be able to connect to my ecs fargate task ### Current Behavior It fails to connect to ecs fargate task command ` aws ecs execute-command \ --region us-west-2 \ --cluster core-services \ --task d179d101efa94c98aa62340b5705d726 \ --container app \ --command "/bin/bash" \ --interactive Error `` The Session Manager plugin
Steps
- What was reported:
Issue aws/aws-cli#9070 (closed, 15 comments): ### Describe the bug I am unable to use ecs execute-command to connect to my ecs fargate task ### Regression Issue - [X] Select this option if this issue appears to be a regression. ### Expected Behavior I should be able to connect to my ecs fargate task ### Current Behavior It fails to connect to ecs fargate task command
2. Error ``` The Session Manager plugin was installed successfully.
3. What works:
If ecs execute-command fails with TargetNotConnectedException even though the agent looks healthy, look at your sidecars. One user fixed it by removing the Fluent Bit log router container, and another by disabling Datadog-agent logging. Logging sidecars can interfere with the SSM session the exec command needs, so disable them one at a time to find the culprit. Treat this as a diagnosis step, not a universal fix.
## When to use
You are seeing this: What works: If ecs execute-command fails with TargetNotConnectedException even though the agent looks healthy, look at your sidecars. Use this skill when you run into "aws ecs execute-command fails with TargetNotConnectedException".
## When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
## Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
## Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
In the GitHub issue, the reporter asked: aws ecs execute-command fails with TargetNotConnectedException. The working answer that came out of the thread: If ecs execute-command fails with TargetNotConnectedException even though the agent looks healthy, look at your sidecars. One user fixed it by removing the Fluent Bit log router container, and another by disabling Datadog-agent logging. Logging sidecars can interfere with the SSM session the exec command needs, so disable them one at a time to find the culprit. Treat this as a diagnosis step, not a universal fix. Source: https://github.com/aws/aws-cli/issues/9070
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_4pABIkpitraCEV25ya4I2A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">aws ecs execute-command fails with TargetNotConnectedException <span>— Vectle</span></a>