简体   繁体   中英

How to ensure only one instance of an AWS ECS scheduled task run at the same time?

Just like cron , AWS ECS Scheduled Tasks do not provide any built-in solution to prevent multiple instances of a scheduled task run at the same time.

One common way to solve this problem for cron is to create lock files.

An example that I found is https://github.com/bgentry/lock-smith . However, it says it is still in beta quality and has not been updated for several years.

Are there any other established solutions/utilities to solve this problem for ECS?

What do you use to manage ECS? Terraform, some other IaC, or manually? So far I got it just fine with Terraform having ECS (EC2), ASG for it ( 1,1,1 for min,max,desired ) and setting which allowed to kill current task before deploying new one, to have RAM to do so: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#deployment_minimum_healthy_percent

Some other answer I've read ( AWS ECS. How to ensure only one instance of a task is running? ) suggests that you may be not using ECS "service" functionality to its potential, and per https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-scheduled-scaling.html you are encouraged to do so.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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