我在“旧的 aws UI”上进行了 ecs fargate 和蓝/绿部署。
并尝试使用 aws 工具包在 vscode 上启用命令执行。
但是“[错误]:aws.ecs.enableEcsExec:InvalidParameterException:无法在具有 CODE_DEPLOY 部署控制器的服务上强制执行新部署。使用 AWS CodeDeploy 触发新部署。(statusCode: 400..)”错误。
所以我在终端上运行这个命令。
aws ecs update-service \
--region ap-northeast-2 \
--cluster {} \
--task-definition {} \
--enable-execute-command \
--service {} \
--desired-count 1 \
--force-new-deployment
但是调用 UpdateService 操作时发生错误 (InvalidParameterException):无法使用 CODE_DEPLOY 部署控制器更新服务上的任务定义。使用 AWS CodeDeploy 触发新部署。出现错误。
我认为在 vscode 上启用命令执行无需蓝/绿部署即可正常工作。
如何保持蓝/绿部署并使用开放的fargate终端?
如果我需要在codedeploy上设置一些配置,如何设置?
要求聊天 GPT
In a Blue/Green deployment in AWS CodeDeploy, the deployment process revolves around creating a new set of resources (the green environment) and gradually shifting traffic to the new environment. This approach doesn't natively support executing commands directly on instances because CodeDeploy is focused on the deployment and traffic shift process.
错误是因为
--force-new-deployment
。
--force-new-deployment
将执行 ROLLING
部署,这在您的设置中是不允许的,因为您将部署类型设置为 CODE_DEPLOY
。
致
enable-execute-command
:
aws ecs update-service \
--cluster clusterName \
--service serviceName \
--enable-execute-command \
--region region
验证:
▶ aws ecs describe-services \
--cluster clusterName \
--service serviceName \
--region region \
| jq -r '.[] | .[].enableExecuteCommand'
▶ true
然后进行
CODE_DEPLOY
部署,因为:
您无法为现有任务开启 ECS Exec。它只能在新任务时打开。 https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html#ecs-exec-considerations