Immutable solution version
aws ecs execute-command fails with TargetNotConnectedException
Complete solution
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.
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 was installed successfully.
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.
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 1 · 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>