What is Amazon ECS (EC2 Container Service)?
Amazon EC2 Container Service (ECS) is a highly scalable, high performance container management service that supports containers and allows you to easily run and manage Docker enabled applications across a cluster of Amazon EC2 instances.
And now you guys are thinking, but what does that mean?
It means that the same Docker containers that you currently use will run exactly the same on Amazon ECS. It eliminate the need to install, operate and scale your own cluster management infrastructure and handles the complexity of running multiple containers like where in the cluster to schedule the container, availability, scalability and monitoring. Amazon ECS lets you launch and stop container-based applications with simple API calls, allows you to get the state of your cluster from a centralized service, and gives you access to many familiar Amazon EC2 features.
- It gives you features available within other EC2 services like Elastic load balancing, EBS volumes and security groups. There is really no new skill set required to work with ECS besides what is required in EC2. ECS simply relies on EC2 instances and EBS volumes.
- It abstract all the complexity of the infrastructure, so you can focus on designing, building and running containerized applications and you can imagine how much time it save.
- It enables you to grow a single container to thousand of containers across hundreds of instances without any additional complexity in how you run your application.
- It is a very flexible approach for placing containers. You can use it for applications that require a lot of time to run.
- It works with other Amazon services such as load balancing and block storage and provides APIs for integrating or extending the service.
The major components in Amazon ECS are:
- Cluster: A cluster is a logical grouping of EC2 instances on which ECS tasks are run.
- Task Definition: The task definition is a text file, in JSON format, describing the containers that together form an application. Task definitions specify various parameters for the application e.g. container image repositories, ports, storage etc.
- Tasks and Scheduler: A task is an instance of a task definition, created at runtime on a container instance within the cluster. The task scheduler is responsible for placing tasks on container instances across your clusters based on your resource needs. For example CPU, RAM and availability requirements. Using the available schedulers, you an schedule long-running applications and services. The ECS service scheduler keeps a desired count of tasks, the Docker container that comprise your application running and behind a load balancer.
- Service: A service is a group of tasks that are created and maintained as instances of a task definition. The scheduler maintains the desired count of tasks in the service. A service can optionally run behind a load balancer. The load balancer distributes traffic across the tasks that are associated with the service.
- Container Agent: The container agent runs on each EC2 instance within an ECS cluster. The agent sends telemetry data about the instance’s tasks and resource utilization to Amazon ECS. It will also start and stop tasks based on requests from ECS.
- Image Repository: Amazon ECS downloads container images from container registries, which may exist within or outside of AWS, such as a accessible private Docker registry or Docker Hub.
How to monitor containers and clusters?
You can monitor CPU and memory utilization of running tasks as grouped by ECS Task Definition, Service or Cluster through Amazon Cloud Watch. You can also set Cloud Watch alarms to alert you when your clusters need to scale up or down.
Its an overview to Amazon ECS, in my upcoming blogs I’ll explain how we can automate deployment process using Amazon ECS and other tools like Consul (for service discovery) along with how to manage zero down time deployment.
Hope you like it. 🙂 Please keep in touch !!