👉 AWS Debug Games (Beta) - Prove your AWS expertise by solving tricky challenges.

👉 AWS Debug Games - Prove your AWS expertise.

Running containers on spot infrastructure

Michael Wittig – 14 Apr 2021

Running workloads on spot infrastructure is significantly cheaper. You can reduce your bill by 50% or more. Keep in mind that spot workloads can be terminated at any time. If you are lucky, you will be noticed 2 minutes upfront to shut down gracefully. In this blog post, I compare the options that AWS provides to run container workloads on spot infrastructure.

Reduce your AWS bill


After you select your scheduler EKS or ECS, you can choose from the following options to run your containers on spot:

  • ECS
    • Fargate
    • Self-managed EC2
  • EKS
    • Managed node groups
    • Self-managed EC2

Self-managed EC2 benefits from all the spot features that are available for EC2 instances. The downside is the self-managed part: You are responsible for scaling, patching, monitoring, and so on. Therefore, I recommend using the option highlighted in bold. If your scheduler of choice is ECS, I recommend running your workload on Fargate Spot. All you need to do is to turn a single knob. If you prefer EKS, managed node groups are the way to go with native support for spot.

Looking for a new challenge?


    Cloud Operations Lead

    DEMICON • AWS Advanced Consulting Partner • Remote (Europe)
    service-delivery-management hiring devops platform

EKS Fargate does not support spot at this time!

Fallback to on-demand?

How can we fall back to on-demand capacity if the spot capacity was terminated? My usual answer is this: Spot capacity is cheap because AWS can, at any time, decide to take it away from you. If you can not accept that spot capacity can be terminated at any time, it might not be a good fit for your workload!

But wouldn’t it be nice if we could benefit from the spot savings for most of the time but with a safety net of on-demand capacity? If you use ECS, there is no native way of implementing a fallback. If you use EKS, kubernetes and the Autoscaler can do the job. The following video goes into details and includes demos:

  • Spot Refresher
  • Demo: ECS Fargate
  • Pitfall: Handle interruption notice
  • Pitfall: Fallback to on-demand
  • Demo: EKS managed node group


AWS supports many options to run containers on spot infrastructure to optimize your AWS bill. The clear winners in terms of ease of use are ECS Fargate and EKS managed node groups. I was able to switch from on-demand to spot using ECS Fargate in a couple of minutes. Since then, I enjoy the lower AWS bill :)

Become a cloudonaut supporter

Michael Wittig

Michael Wittig ( Email Twitter LinkedIn Mastodon )

We launched the cloudonaut blog in 2015. Since then, we have published 365 articles, 68 podcast episodes, and 68 videos. It's all free and means a lot of work in our spare time. We enjoy sharing our AWS knowledge with you.

Please support us

Have you learned something new by reading, listening, or watching our content? With your help, we can spend enough time to keep publishing great content in the future. Learn more

Amount must be a multriply of 5. E.g, 5, 10, 15.

Thanks to Alan Leech, Alex DeBrie, Christopher Hipwell, Jason Yorty, Jeff Finley, jhoadley, Johannes Konings, John Culkin, Jonathan Deamer, Juraj Martinka, Ken Snyder, Markus Ellers, Oriol Rodriguez, Ross Mohan, sam onaga, Satyendra Sharma, Simon Devlin, Todd Valentine, Victor Grenu, and all anonymous supporters for your help! We also want to thank all supporters who purchased a cloudonaut t-shirt.