Elastic Container Service
Get an overview of the Elastic Container Service and its workflow.
We'll cover the following
Running applications typically require servers. In the good old days, it was impossible to define and enforce boundaries for running applications on a server and ensure fairness in resource usage. As a result, we were constrained to run a single application on a server, which obviously resulted in poor resource utilization.
Introducing virtualization allows us to create multiple virtual instances of physical resources on a single physical machine.
What is containerization?
A virtual machine (VM) is a virtualized instance of a computer system being managed by software, termed a hypervisor. Each VM operates as a self-contained and isolated entity with its virtual resources. Multiple VMs can coexist on the same physical server. Virtualization resulted in better resource utilization. It is important to highlight here that each VM is completely isolated and has its own operating system. This approach has several limitations, including limiting the number of VMs that can share a physical system.
Containers provide a lightweight virtualization solution when compared to VMs, as multiple containers running on a host physical system share OS. Like VMs, each container has its own set of resources, including CPU share, but it shares the OS with other containers. Docker is a widely used container runtime for managing containers.
Containers offer several benefits compared to VMs and are widely used to bundle applications. However, managing containers in a production environment and providing services such as fault tolerance and load balancing is a challenging task.
Amazon Elastic Container Service (ECS) is a fully managed container orchestration service by AWS. It simplifies the deployment and management of containerized applications with features like auto-scaling, load balancing, and container health checks. It allows us to run Docker containers at scale. ECS integrates seamlessly with other AWS services, providing a flexible and efficient solution for deploying and managing containerized workloads.
How Amazon ECS works
ECS uses images stored in a registry, such as the
Task definition: This defines how our containers are configured, including image, CPU and memory requirements, networking configuration, etc.
Cluster: It’s a logical grouping of infrastructure (EC2 instances or Fargate) to run the tasks or services. ECS manages the infrastructure underlying our cluster. We can deploy the task definition as a task or a service to a cluster.
Task: A task is an instantiation of a task definition. It represents one or more Docker containers running together on a container instance. ECS schedules tasks onto container instances based on resource requirements and availability.
Service: Deploys a long-running task, ensures a specified number of tasks are running, and optionally manages their lifecycle (rolling updates, autoscaling). Services are used for applications that require continuous availability.
The following diagram shows the workflow of Amazon ECS and its components:
Get hands-on with 1300+ tech skills courses.