Monitoring ECS hosts

ECS runs on top of EC2. Therefore, everything that can be done for EC2 can and should be done for ECS, including disk space monitoring. The main difference is that you have more options on how to implement it:

  1. Your first option consists of duplicating what we did with EC2 and have the cloudwatchmon run on every EC2 instance running ECS. To implement this, you can create a new Ansible role for the ECS host and add the installation and execution of Ansible to the UserData variable of the ecs-cluster-cf-template.py, the way we did in nodeserver-cf-template.py.

 

  1. Your second option also relies on the UserData field, but, this time, you create a new container that runs cloudwatchmon and creates a task for it. The UserData file would end with something such as this:
$ aws ecs start-task 
--cluster $cluster
--task-definition cloudwatchmon:1
--container-instances $instance_arn
--region $region
  1. Your last option is to take advantage of the task placement feature that ECS offers. This will let you run your containers using a spread strategy so that, by launching as many containers as you have ECS hosts, you will be able to collect the stats of each ECS server. You can read more about task placement at http://amzn.to/2kn2OXO.

Once you have that part under control, you can look at the ECS service itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset