EC2 Container Service is the newest from the AWS family,
introduced in spring 2015. This article is about how I see (dis)advantages of
this service, how I tried to use it for the very first time and what needs to
be done in the future.
How I understand EC2 Container Service?
| Fig. 1 - Docker Integration |
EC2 Container Service is basically about
integration of the docker into EC2
instances. Added value is the cluster management over running docker images.
Management
of the cluster is provided by typical master – slave architecture. In this case
master is the service itself, running automagically in the cloud. Slaves are
docker clients installed on EC2 instances.
Fig.
2 - Cluster Architecture
|
In the naming convention of the AWS, EC2 instance that is
running docker client (also called
container agent) is called container instance or host instance.
Each container instance has to be assigned to a cluster.
Default cluster is also available and is pre-generated for every AWS account.
These days (May 2015) cluster has only labeling function. Cluster can be used for better organization
or recognition of your container instances for example according to their
usage.
ECS Master process can be configured directly from the AWS Console or by calling API queries.
Container Service can be configured for run a task or
service. Task, group of tasks or service are assigned to a docker image of your
choice. You can also manage resources, mount points, volumes and other
parameters.
For better understanding you can think about
boxes in the picture below as different docker images. Each image can execute
specific task/process.
| Fig. 3 - ECS Life |
Case study – migration of cron jobs to EC2 Container Service
Situation is that customer runs on one of his EC2 instances
cron jobs – hot candidates for solution based on EC2 Container Service.
Advantages would be independency from specific EC2 instance and scalability.
After few days of research everything is ready for testing:
- Docker image
- Container Instance in cluster
- Tasks definitions
| Fig. 4 – Scheduler; Image from: play.google.com |
…but something is missing. I thought that built-in scheduler
could be a part of service like this, but I was wrong. Despite that an API is ready for queries from
third party schedulers; there is no direct support of built-in scheduler
neither from AWS console or API.
So you are in the dead end, if you are trying to
use ECS in task/batch process mode. I think that for this type of actions is
built-in scheduler necessary.Long story short, for running simple tasks (like cron jobs) or batch processes you have 3 options:
- Run tasks manually
- Control tasks using third party scheduler
- Control tasks directly using API
(Dis)advantages of EC2 Container Service
When it comes to advantages, major one is that ECS brings one of the most popular technologies directly into the solution – Docker. That fact allows:
- Build, ship and run distributed application for example behind ELB
- Manage resources / containers across EC2 container instances cluster
It’s ideal when you need ship your application inside docker
image and quickly run it in the big world of clouds, full of fancy features
like scaling, balancing, routing and others.
As I mentioned previously, I really miss support of built-in scheduler and that I consider as a big disadvantage. Someone could miss also some kind of auto scaling for running containers as we know it from EC2. In this version you have to configure resources manually and ECS master process takes care only for distribution of containers along the container instances cluster.
I hope that these missing parts are already on the roadmap at AWS and then ECS become pretty smart, complex and useful service.
No comments:
Post a Comment