13 Apr 2016

Using OpsWorks to manage AWS ECS Cluster instances


AWS Elastic Beanstalk already provides an easy route for Docker PaaS, but although scalable it's only so for full instances. The AWS EC2 Container Service (ECS) takes things several steps further by providing options for actual 'container' scaling and clustering across Docker enabled hosts. Task and service configuration with related scheduling is easily managed however as yet there is no direct hook for managing the underlying cluster (instances). You could manually configure via scaling groups within the E2 console, or you could use OpsWorks, which is easier.

RDS has been available as a linked option from OpsWorks for quite some time. ECS, like the service itself, is a more recent addition, and an interesting one. For example, if you intend to use the extended functionality of ECS, perhaps with Jenkins hooks for deploy and update from the EC2 Container Registry, then other than management for the cluster instance(s) themselves there's actually not much else OpsWorks has to contribute?
That said, perhaps that's enough in itself to be really useful, and it's also not uncommon (in fact it's predominantly the norm) to link services within AWS rather than use them in isolation, and to be honest it's actually a pretty neat and easy way to manage the cluster host instances. Let's take a look at how.

Firstly, create a layer from the ECS tab, selecting your empty/new cluster and security group etc (You can only register one cluster per stack) :


Next, add an instance and start it, making sure public IP is enabled (This is vital for it to boot and register). OpsWorks takes care of the role creation and linked registration with your ECS cluster :

Once up and registered the instance will show green and online in the OpsWorks layer :

And as registered for use (ACTIVE) in the linked ECS cluster :  

From there it's on to configuring services, tasks etc and moving into deployment. 

Using OpsWorks for cluster host management is a good idea. It provides default instance resilience via layer 'Auto Healing' with layer config offering easy attach and mount for EBS volumes, and as it's OpsWorks adding extra instances into the layer, be they static, timed or load based, is an equally simple process :

With easy scheduling (i.e for timed) :




No comments:

Post a Comment