简体   繁体   English

Amazon ECS任务和自动扩展组

[英]Amazon ECS tasks and autoscaling groups

I'm relatively new to Amazon ECS and I have a question that bothers me. 我是Amazon ECS的新手,我有一个困扰我的问题。

In a process of testing a minimum-viable cluster I ran into realization that one couldn't create dynamically-sized service. 在测试最低可行集群的过程中,我发现无法创建动态大小的服务。 There is only one choice specifying desired number of tasks changing service's parameter through console or CLI or CloudFormation. 只有一种选择通过控制台或CLI或CloudFormation指定更改服务参数所需的任务数。 To put it differently, the number of tasks is statically defined. 换句话说 ,任务数是静态定义的。 And that contradicts with autoscaling group's nature because it scales dynamically upon need. 这与自动伸缩组的性质相矛盾,因为它会根据需要动态伸缩。

So, how does one dynamically scale ECS tasks? 那么,如何动态扩展ECS任务?

Update: I keep getting + points on this, my comment is no longer true. 更新:我一直对此表示+观点,我的评论不再正确。 As Lukas said, there is new functionality and documentation and it is possible now. 正如Lukas所说,有新的功能和文档,现在可能。 I'm leaving the following for historical reasons. 由于历史原因,我将保留以下内容。 AWS is always changing so please be weary about how old the information is when you decide your architectural decisions! AWS总是在变化,因此请您在决定架构决定时对信息的时效性感到厌倦!

With auto-scaling groups you natively get to tie together auto-scale triggers with cloudwatch directly which is what you're hinting at when you say dynamically because you set a minimum, maximum and a +/- instance addition on cloudwatch alarms. 使用自动缩放组,您自然就可以直接将自动缩放触发器与cloudwatch绑定在一起,这是您动态说出的提示,因为您在cloudwatch警报上设置了最小,最大和+/-实例添加。

With ECS you can, it's just a bit different. 有了ECS,您就会有所不同。 There's a good post about it on the amazon blog , but the gist of it is that you subscribe SNS topics to the Cloudwatch alarms, which trigger Lambda functions that increase or decrease the number of tasks. 亚马逊博客上有一篇很好的文章,但要点是您将SNS主题订阅了Cloudwatch警报,从而触发了Lambda函数来增加或减少任务数量。 It's essentially the exact same functionality but you have more pieces to tie together. 它本质上是完全相同的功能,但是您需要结合更多的功能。 You could (and probably should) also have that alarm trigger your auto-scaling group for your ECS cluster as well. 您可能(也应该)使该警报触发您的ECS群集的自动扩展组。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM