Fargate Task Recycling

Posted on October 27, 2020

UPDATE 11/8/2023

I got a message on LinkedIn asking for an update as one of the links had gone stale. I’ve replaced it with an archive link, no idea if this is still how Fargate operates under the hood. There is also the new task maintenance page that seems to offer a similar explanation.

Original post

Came across something curious in my investigation into why I had a couple of Cloudwatch alarms going off.

Curious container restarts

Like clockwork, every six hours I was getting container restarts. I was absolutely perplexed, because our users had not reported any disruptions.

I started some mad searching and eventually found this article talking about it.

Summary notes:

  • The underlying managed infrastructure needs updates
  • AWS will do a rolling deploy of a new task instance and pull down the old one so that you’re always up to date

Just thought it was an interesting thing, took me a little longer than I like to admit searching for the symptoms “ECS container reboots every six hours”.

Stephen Gream

Written by Stephen Gream who lives and works in Melbourne, Australia. You should follow him on Minds