4
votes

Amazon ECS provides really good service for scheduled tasks : ECS Scheduled tasks that works pretty well. However it's important in this always keep one ECS instance in ECS cluster. What is the best way:

  1. Launch/scale in ECS instance in for periodical job (just before task execution);
  2. Run ECS tasks on newly created instance;
  3. Terminate/scale out instance after completion.

One possible workaround is to write lambda that will do smth. like that (launch ec2) but it looks as too much pain.

1

1 Answers

4
votes

Finally I found out an easy solution for that problem. Everything was quite simple:

  1. Go to Autoscaling groups (This you can find on EC2 dashboard-> Autoscaling section);
  2. Create scheduled action (In that case necessary frequency can be specified for your container instance);
  3. Save your configuration. Instance will be added in the specified time.
  4. In my case I also need to scale down this instance in 1 hour period.