Intro to AWS Blox: An Open Source Container Scheduler for ECS
EC2 Container Service (ECS) is AWS’ container management service. It makes it easy to run containers on EC2 instances at scale. At re:Invent last year, AWS announced a new open source container scheduler for ECS called Blox. In this post, we’re going to look at how Blox fits into a typical ECS workflow, and why you would consider using Blox.
The Backdrop: CloudWatch Events
Last year, AWS announced support for CloudWatch Events (CWE) for ECS. This is an event streaming service that reports on real-time event changes within an ECS cluster. It also allows other services to act on the event stream from ECS, and this is very useful for extending ECS’ capability.
You would first need to create a CWE rule. This allows you to select which events you’d like to process. Then, you specify a target for the events like a SNS (Simple Notification Service) topic, and finally ‘put’ the events to SNS.
Enabling CloudWatch Events was the first step in opening the doors for customers to extend ECS with their own tools for container management. Now, with Blox, AWS takes the next step by giving users a way to have a custom scheduler to manage their containers running on EC2 instances.
What Is a Container Scheduler?
A container scheduler assigns tasks on a cluster of container instances. You can choose how to schedule your tasks based on your application’s requirements, instance availability, and a host of other factors. A scheduler makes it easy to manage container workloads at scale, and is an important part of managing containerized applications.
A container scheduler is not the same as a container orchestration tool like Kubernetes, or Swarm. These tools include schedulers, but are much more than that. They manage the entire workflow of container clusters. A scheduler only decides which containers should run on which instances.
AWS mentions that ECS customers were already using CWE streams to create custom schedulers. They were building business logic into these custom schedulers. But it was a complex process involving API calls. AWS saw the need to create a custom scheduler and open-source it so users can further enhance it, and in doing so, improve ECS itself. This led to the creation of Blox. The goal of Blox is to extend ECS with custom schedulers, dashboards, and other tools, using events rather than having to make API calls.
What’s in the Blox?
Blox currently includes two projects—a cluster-state-service, and a daemon-scheduler. The cluster-state-service consumes an event stream from AWS CloudWatch Events, and stores it in an etcd database. So, whenever the state of a container or instance in the cluster changes, it’s recorded in the cluster-state-service. The cluster-state-service also offers REST APIs so other services can take action based on the events stored in it.
The daemon-scheduler then uses the cluster-state-service APIs to track container instances. As new instances enter the cluster, the daemon-scheduler will automatically schedule a task for the new instance. It schedules only one copy of a task on each container instance.
There are two ways to run Blox—either locally on your laptop, or on the AWS cloud (with Lambda as a proxy). Blox is meant for developers who want to build container management tools based on the current state of resources in the ECS cluster.
Blox and Open Source
According to the roadmap on Github, Blox will soon support Mesos’ scheduling frameworks such as Marathon and Chronos. However, there is no mention of Kubernetes or Swarm, which are the two most widely used container orchestration tools today. This has confused some who are used to the Docker ecosystem being dominated by open source tools that play well with each other.
However, Blox is not out to solve scheduling for the entire container ecosystem. One of the goals behind Blox is for the open source community to give feedback on Blox’s daemon scheduler, and in turn, help AWS improve ECS’ scheduling features, and extensibility. Its ambitions are as far as ECS, and it serves this purpose well.
As ECS matures, it needs to support niche customer requirements if its to hold its own in the competitive Docker ecosystem. Blox is a curious move by AWS that recognizes the importance of the open source community, but is centered on its own cloud offerings. Will this strategy pay off in the long run? Let’s wait and see.