Amazon Web Services offers users multiple ways to deploy and manage server clusters. The AWS EC2 Container Service...
gives customers a middle ground between AWS Elastic Beanstalk, which automates the process, and do-it-yourself cluster administration.
With AWS Elastic Beanstalk, developers upload code and let the service handle resource provisioning, deploy code, autoscale and monitor. In a do-it-yourself model of server clusters management, developers choose Amazon Machine Images (AMIs), install libraries, then code and implement cluster management tools. To understand how AWS EC2 Container Service (ECS), which is currently in preview mode, is a middle ground between the two, you need to understand Docker.
Docker runs on Linux and provides a way to package application code, libraries and configurations onto containers. Docker containers are files that contain code and libraries that run in isolation within an individual Docker runtime daemon. The platform is much like running a virtual, but lightweight, environment. But unlike virtual machines, Docker containers do not need a hypervisor.
AWS provides Docker runtime environments that allow Docker containers to run in ECS. Developers create Docker containers from their development environments. Therefore, the container possesses all the components and libraries it needs to run, which can be a boon to systems administrators. Docker eliminates the need for admins to chase down problems with incorrect library versions or packages, giving them more time to focus on managing servers.
Developers can also use preconfigured Docker containers. Docker Hub is a repository of preconfigured, downloadable containers; there are currently more than 45,000 public images available in Docker Hub.
Managing AWS ECS
Although ECS is based on Docker, the service implements some additional structures for managing server clusters, including the following:
- A container instance -- an EC2 instance running an ECS agent
- A task definition, which is a collection of container definitions
- A task, which is a running instance of a task definition and a Docker container
In addition to creating identity and access management, or IAM, users, assigning roles, and generating key pairs, admins must create a virtual private cloud for the cluster. When launching an EC2 instance, use a special Amazon Machine Instance (AMI) called amzn-ami-2014.09.1-amazon-ecs-optimized-preview2. You can also use the AWS command-line interface to monitor and list containers using the "aws ecs" commands. For details on this, see the ECS Getting Started Guide.
Next, specify a task definition to run tasks on a cluster. A container definition includes parameters such as the name of the container, the image to use, the number of CPU units to allocate to the container, the amount of memory to allocate, links to other containers it will communicate with, an entry point that specifies a command to run when the container starts, and a set of environment variables.
AWS ECS has some service limits. Currently, you're allowed a maximum of only two server clusters per account. ECS also allows only 100 container instances per cluster, and only 10 containers are allowed per run-task or start-task. But all limits are subject to change.
Docker does not replace configuration management tools, such as Chef or Puppet; you could use these tools to create your own Docker images. With Docker, all application code and supporting packages are in the container when it's deployed -- there's no need to spend additional time installing code after an instance starts.
About the author:
Dan Sullivan holds a master of science degree and is an author, systems architect and consultant with more than 20 years of IT experience. He has had engagements in advanced analytics, systems architecture, database design, enterprise security and business intelligence. He has worked in a broad range of industries, including financial services, manufacturing, pharmaceuticals, software development, government, retail and education. Dan has written extensively about topics that range from data warehousing, cloud computing and advanced analytics to security management, collaboration and text mining.