Search code examples
amazon-web-servicesdockeramazon-ec2amazon-ecsamazon-ec2-spot-market

Spot instances on Amazon ECS


I am currently using on demand instances for my ECS cluster in AWS. I am running ~50 small containers on each instance. Each of them with same reserved CPU and memory.

In order to save costs, I want to switch to using spot instances instead.

Will ECS handle buying of spot instances and keeping my amount of desired server according to my auto scale settings?

What happens when an instance is terminated? Will all the tasks running on the instance be terminated or will they move to another spot instance?

Are spot instances even available for T2/T3?


Solution

  • When creating an ECS cluster on AWS, you will be provided with an option to choose spot instances.

    As far as I know, this can't be changed.

    As you can see in the above mentioned documentation, AWS ECS will indeed handle the buying of the spot instances according to your autoscaling settings.

    Spot instances can be terminated at any time. This means that your application will cease to run and will be restarted on a different machine. That's why it is advised to put redundancy on your application.