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;
- Load balancer finds a problem with your task and kills it.
- The task stops.
- The service has a minimum task level of 1
- The ECS container starts a new task.
- The task is bad; goto step 1.
So how do you get out of this loop?
Do the following;
- Open your cluster
- Click on your service
- Click Update
- Set “Number of tasks” to 0
- Click “Skip to review”
- 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
- Open your cluster
- Click on your service
- Click Update
- In the “Revision” drop down choose the previous revision
- Click “Skip to review”
- Click “Update Service”
This will cause the current revision to be drained and a new previous task will be launched.