俺です。
ある日。というか2018/9/25JSTぐらいからなんですが、
以下なコマンドでデプロイしてたservice upがエラーを吐いたので泣く泣く対処した経緯を残します。
環境
AWS_DEFAULT_REGION=ap-northeast-1
ecs-cli: 1.6.0
deploy & error messsage
- ecs-cli deploy command
ecs-cli compose -f docker-compose.ecs.yml \
--project-name orenopurojekuto service up --force-deployment \
--target-group-arn "<orenotargetarn>" \
--container-name nginx \
--container-port 80 \
--cluster orenocurasuter
- error message
maximumPercentかminimumHealthyPercentを指定しないといかんざきと返されました。
time="2018-10-02T01:41:31+09:00" level=info msg="Using ECS task definition" TaskDefinition="orenosaikounotasuku:002"
time="2018-10-02T01:41:31+09:00" level=warning msg="You cannot update the load balancer configuration on an existing service." serviceName=orenopurojekuto
time="2018-10-02T01:41:31+09:00" level=error msg="Error updating service" error="InvalidParameterException: At least one of maximumPercent or minimumHealthyPercent must be present in DeploymentConfiguration\n\tstatus code: 400, request id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" service=orenopuroject
time="2018-10-02T01:41:31+09:00" level=fatal msg="InvalidParameterException: At least one of maximumPercent or minimumHealthyPercent must be present in DeploymentConfiguration\n\tstatus code: 400, request id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
- ecs-cli help
ただしhelpを見ると Optional parameter
であり、デフォルト値は決まっていると。
どーゆー骨茶
$ ecs-cli compose service up --help
--deployment-max-percent value [Optional] Specifies the upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Defaults to 200.
--deployment-min-healthy-percent value [Optional] Specifies the lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. Defaults to 100.
対策
Optionalと言われてるはずのパラメータを指定した。
ecs-cli compose -f docker-compose.ecs.yml \
--project-name orenopurojekuto service up --force-deployment \
--target-group-arn "<orenotargetarn>" \
--container-name nginx \
--container-port 80 \
--deployment-max-percent 200 --deployment-min-healthy-percent 100 \
--cluster orenocurasuter
INFO[0000] Using ECS task definition TaskDefinition=""
WARN[0000] You cannot update the load balancer configuration on an existing service. serviceName=
INFO[0000] Updated the ECS service with a new task definition. Old containers will be stopped automatically, and replaced with new ones deployment-max-percent=200 deployment-min-healthy-percent=100 desiredCount=2 serviceName= taskDefinition="
--以下省略--
完ってことで。