aws ecs 执行命令失败,因为未启用

Ana*_*kov 9 execute amazon-web-services amazon-ecs aws-cli

我在跑步aws ecs execute-command --cluster UltimaF --task 838d773b17954bcfbbacf343fb4fea70 --container ultima --interactive --command "/bin/sh"

\n

取回:An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: The execute command failed because execute command was not enabled when the task was run or the execute command agent isn\xe2\x80\x99t running. Wait and try again or run a new task with execute command enabled and try again.

\n

我已保证:

\n
    \n
  1. 任务正在运行。
  2. \n
  3. aws ecs describe-tasks --cluster UltimaF --tasks 838d773b17954bcfbbacf343fb4fea70回报"enableExecuteCommand": true
  4. \n
  5. 任务角色附加了以下权限:\n
      \n
    • ssmmessages:CreateControlChannel
    • \n
    • ssmmessages:CreateDataChannel
    • \n
    • ssmmessages:OpenControlChannel
    • \n
    • ssmmessages:OpenDataChannel
    • \n
    \n
  6. \n
\n

我在 Windows 上运行,aws-cli/2.8.2

\n

更新:\n运行ecs exec 检查器后后,我有两个黄色项目和一个红色项目:

\n
    ----------\n      Managed Agent Status\n    ----------\n         1. STOPPED (Reason: null) for "ultima" - LastStartedAt: null\n    ----------\n      Init Process Enabled (first-run-task-definition:12)\n    ----------\n         1. Disabled - "ultima" \n
Run Code Online (Sandbox Code Playgroud)\n

更新二:

\n

问题表明\necs:clustername_taskid_containerruntimeid但对我来说它返回一个错误:An error occurred (TargetNotConnected) when calling the StartSession operation: ecs:UltimaF_838d773b17954bcfbbacf343fb4fea70_838d773b17954bcfbbacf343fb4fea70-2587323273 is not connected.

\n

问题:如何连接?

\n

小智 6

确保在任务定义的结构/JSON 中“ enableExecuteCommand ”设置为 true。

aws ecs describe-tasks --cluster <CLUSTER> --tasks <TASK_ARN>


小智 1

我在运行执行命令之前和之后都遇到了这个问题,它仍然是相同的,因此我删除了服务下的任务,并且新容器可以毫无问题地访问。