amazon-web-services - 如何为使用计划任务且无服务的 ECS 集群设置自动伸缩?

标签 amazon-web-services docker amazon-ec2 amazon-ecs autoscaling

我有一个 ECS 集群,我有一个绑定(bind)的 ec2 实例和一个计划任务集,使用 ECS 仪表板上的“计划任务”功能每天运行。
这个任务运行了一堆容器,每个容器的内存都相对昂贵,而且所有容器同时运行时更加复杂。
我目前没有为 ECS 集群设置服务,据我了解,为了我的目标,在某个时间间隔运行设置的任务,不会使用服务。
AWS 在 ECS 文档中对服务的定义说:

An Amazon ECS service enables you to run and maintain a specified number of instances of a task definition simultaneously in an Amazon ECS cluster.
因为这不是我想要的;相反,我只需要按我收集到的某个预定时间间隔运行一项任务,我不需要绑定(bind)到我的 ECS 集群的服务。
我的问题是如何为我的计划任务设置自动缩放?我能找到的关于 ECS 集群中自动扩展的唯一引用是创建自动扩展的 ecs 服务——这又不是我想要的(至少从我理解 ecs 服务的工作方式来看)。
我需要的是让我的 ec2 实例在我的计划任务运行时自动扩展,根据需要分配更多资源以运行任务。我是否只需要在 ec2 仪表板中绑定(bind) ecs 集群的特定 ec2 实例上设置自动缩放,还是有其他方法可以直接从 ECS 执行此操作?

最佳答案

I want; instead, I need to just run a task on some scheduled interval I gather I do not need a service tied to my ECS cluster.


对于上述用例,最好使用法盖特您无需维护或担心自动扩展调度 ,您只需要设置计划任务,AWS 将处理您的任务所需的内存和其他资源,而且您只需 为您的 ECS 任务 使用的资源付费,与您为容器实例付费的 EC2 类型任务不同。

AWS Fargate is a serverless compute engine for containers that works with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). Fargate makes it easy for you to focus on building your applications. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design.


aws fargate
根据触发任务的计划创建云监视规则库,确保容器在完成作业后退出,fargate 将自动停止容器。
enter image description here
enter image description here
cloudwatch-event-rule-to-invoke-an-ecs-task

关于amazon-web-services - 如何为使用计划任务且无服务的 ECS 集群设置自动伸缩?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63145897/

相关文章:

linux - 为什么 docker0 桥在带有法兰绒的 kubernetes 集群中出现?

amazon-web-services - 使用 EC2 Instance Connect 的连接失败(基于浏览器的 SSH 连接)

python - 如何使用 boto3 从 Amazon Lex 响应中获取音频?

amazon-web-services - 创建一个服务目录我是cloudformation模板中的角色

docker - Ubuntu,shopsys 通过 Composer , docker 安装,仍然崩溃

postgresql - 应用程序容器未正确连接到部署中的 postgres 数据库

amazon-s3 - 使用亚马逊的云服务器/应用程序/工具进行编程的经验和技巧?

amazon-web-services - 在 amazon 为什么我不能从公共(public) ip 地址查看我的 tomcat?

sharepoint-2010 - 是否建议将 Amazon EC2 用于持久的面向公众的网站?

amazon-web-services - “未找到 SavedModel 包!” tensorflow_hub 模型部署到 AWS SageMaker