我正在跑步
aws ecs execute-command --cluster UltimaF --task 838d773b17954bcfbbacf343fb4fea70 --container ultima --interactive --command "/bin/sh"
回来:
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’t running. Wait and try again or run a new task with execute command enabled and try again.
我已保证:
aws ecs describe-tasks --cluster UltimaF --tasks 838d773b17954bcfbbacf343fb4fea70
返回"enableExecuteCommand": true
ssmmessages:CreateControlChannel
ssmmessages:CreateDataChannel
ssmmessages:OpenControlChannel
ssmmessages:OpenDataChannel
我在 Windows 上运行,aws-cli/2.8.2
更新: 运行 ecs exec checker 后,我有两个黄色项目和一个红色项目:
----------
Managed Agent Status
----------
1. STOPPED (Reason: null) for "ultima" - LastStartedAt: null
----------
Init Process Enabled (first-run-task-definition:12)
----------
1. Disabled - "ultima"
更新二:
这个问题表明
ecs:clustername_taskid_containerruntimeid
但对我来说它返回一个错误:An error occurred (TargetNotConnected) when calling the StartSession operation: ecs:UltimaF_838d773b17954bcfbbacf343fb4fea70_838d773b17954bcfbbacf343fb4fea70-2587323273 is not connected.
问题:如何连接?
我在运行执行命令之前和之后都遇到了这个问题,它仍然是相同的,因此我删除了服务下的任务,并且新容器可以毫无问题地访问。
确保在任务定义的结构/JSON 中“enableExecuteCommand”设置为 true。
aws ecs describe-tasks --cluster <CLUSTER> --tasks <TASK_ARN>