开始/停止 ECS 服务以在定义的时间间隔内运行和停止任务

huangapple go评论60阅读模式
英文:

Start/Stop ECS services to run and stop tasks at defined intervals

问题

我在我的 ECS Fargate 集群上运行了一个测试自动化套件。最小/最大/期望任务都设置为 1。因此,在运行测试之后,任务停止运行,但另一个任务开始运行。

我想通过 Eventbridge 安排其运行,并在完成后停止,除非再次触发,而不是启动新任务。任务的持续时间约为 20 分钟,我希望每 2 或 3 小时运行一次。

我该如何实现这一目标?

英文:

I have a test automation suite running on my ECS Fargate cluster. The minimum/maximum/desired task are all set to 1. So, after the tests are run, the task stops running but another one gets up and running.

I want to schedule it to run via Eventbridge and stop after it is done, not spin up new tasks unless triggered again. The duration of the task is approx 20 mins and I want it to be run every 2 or 3 hours.

How can I achieve this?

答案1

得分: 2

据我了解,您正在使用 ECS 服务功能。在这种情况下不需要它。您只需要一个任务定义和一个具有计划表达式的 EventBridge 规则,以使用该任务定义启动一次性任务。在这里查看更多信息 - https://docs.aws.amazon.com/AmazonECS/latest/userguide/scheduled_tasks.html

英文:

As I understand you are using the ECS Service feature. You don't need it in this case. You need only a task definition and an EventBridge rule with a schedule expression to start one-off tasks using that task definition. See more here - https://docs.aws.amazon.com/AmazonECS/latest/userguide/scheduled_tasks.html.

huangapple
  • 本文由 发表于 2023年3月1日 15:56:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/75600882.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定