简体   繁体   中英

ECS EC2: How to run 1 task per instance?

I was using ECS Fargate in this way: job arrives -> lambda creates a new task -> Fargate container runs the job -> job finishes -> lambda stop the task

Now, I am migrating from Fargate to ECS EC2 due to its swap feature. I would like to use the same workflow. I believe it could be like this: job arrives -> lambda creates a new EC2 instance running the docker image -> container runs the job -> job finishes -> lambda stop the EC2 instance.

How should I make Ecs create a Ecs-registered Ec2 running my new task when the job arrives.

When you run your tasks, you can specify Task placement constraints . I think for marking specific instance you would have to use custom attributes , as there is no direct selection of instances based on instance-id.

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