我正在使用 EC2 实例运行 AWS ECS 集群,我想要一个命令将任务扩展到 1 个正在运行的实例,然后在一段时间后,当我不需要它时,我想将其缩小到 0。这应该会破坏底层 EC2实例以避免收费。我没有使用 Fargate,因为它不属于免费套餐。
我目前正在使用什么来扩展至 1 并开始运行它:
ecs-cli scale --capability-iam --size 1 --cluster myEC2clusterName --region us-east-1
aws ecs run-task --cluster myEC2clusterName --region us-east-1 --task-definition myTaskDefinitionName:1 --count 1
我目前正在使用什么来缩小规模:
ecs-cli scale --capability-iam --size 0 --cluster myEC2clusterName --region us-east-1
是否有仅在 aws cli 中的等效命令,而无需使用 ecs-cli 来执行相同的操作?
Yes, you can call the UpdateService https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html API or use the update-service https://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html command.
aws ecs update-service --cluster myEC2clusterName --region us-east-1 --service myServiceName --desired-count 0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)