我运行 aws fargate 容器,它们是使用ecs-cli如下方式启动的:
ecs-cli configure --cluster ${cluster_name} --default-launch-type FARGATE --region ${AWS_REGION} --config-name ${config_name}
ecs-cli compose --project-name ${service_name} service up
Run Code Online (Sandbox Code Playgroud)
我想用来aws ecs execute在这些容器中运行命令。我可以在该主题上找到的所有示例都使用aws命令行工具,而不是ecs-cli. 该文档指定,为了使用aws ecs execute,您必须使用 启动该服务--enable-execute-command。
该标志确实存在于aws命令行工具中 - 但没有相应的标志ecs-cli。ecs-cli通过 yaml 文件配置,ecs-params.yml. 但是,文档再次没有提及可在该文件中使用来启用执行命令的设置。这就是我的ecs-params.yml样子:
ecs-cli configure --cluster ${cluster_name} --default-launch-type FARGATE --region ${AWS_REGION} --config-name ${config_name}
ecs-cli compose --project-name ${service_name} service up
Run Code Online (Sandbox Code Playgroud)
我在存储库上找到了一个拉取请求,ecs-cli将此标志添加到命令行(请参阅: https: //github.com/aws/amazon-ecs-cli/pull/1135),这确认它当前不可用。但这并不意味着没有其他方法来指定启用执行命令。
作为替代方法,我尝试aws ecs …