AWS ECS Tips and Tricks

Overview

I have recently started playing with AWS Elastic Container Service and there are a few neat things I have learnt that I wanted to let everyone else know about… read on..

How to stop a service – reboot loop

So you have deployed a bad version of your website and the load balancer health check is failing, so you end up in the following loop;

  1. Load balancer finds a problem with your task and kills it.
  2. The task stops.
  3. The service has a minimum task level of 1
  4. The ECS container starts a new task.
  5. The task is bad; goto step 1.

So how do you get out of this loop?

Do the following;

  1. Open your cluster
  2. Click on your service
  3. Click Update
  4. Set “Number of tasks” to 0
  5. Click “Skip to review”
  6. Click “Update Service”

The service is now set to have a minimum task level of Zero, so now it will stop and NOT restart until you do the reverse and set it back to a number > 0.

How to rollback

So again you have deployed a task with a bug in it, and you quickly want to rollback to a previous version.

ECS makes this super easy, do the following

  1. Open your cluster
  2. Click on your service
  3. Click Update
  4. In the “Revision” drop down choose the previous revision
  5. Click “Skip to review”
  6. Click “Update Service”

This will cause the current revision to be drained and a new previous task will be launched.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.