Introduction
Photo Credit: Freecodecamp
Container Orchestration has become a big word now in cloud native deployments where infrastructure, deployed on containers requires multiple replicas (Different copies of the same container) and needs to be managed effectively on many servers or machines. Initially, to deploy a multi-container application, an engineer will need to write a docker-compose.yml
file and then specify the images to be used in each container in that YML file. Docker-Compose works great when working with one server, but what if there is a requirement to deploy a multi-container application on a cluster of machines or servers? You might think about copying the docker-compose.yml
file over to each of these machines and then spinning up the workloads, which is not a great option because these containers will not know about the existence of the others, autoscaling and load balancing features may not be available and other crucial needs will not be available showing that the solution is not a good approach.
The concept of container orchestration tools comes in โจ, Where multiple containers can be effectively managed. Examples of tools that help achieve this are Docker Swarm, Kubernetes, and OpenShift. These tools work effectively and are a go-to solution when it comes to container Orchestration, but configuring them might be where the issue resides. They are complex to configure and set up on clusters of servers which makes them tedious to use and not a go-to solution for some infrastructure.
ECS (Elastic Container Service)
This is where Amazon ECS (Elastic Container Service) comes into the picture. ECS as the name suggests, is an AWS-managed container service that allows users to effectively manage their container deployment on multiple servers or machines. See this service as an AWS offering that manages your docker container deployments and eases the work of having to manually run some docker management stuff, for example lets say a container died for some reason, you would have to be the one to manually go into your server and restart the container.
ECS manages a lot of workloads and has many service offerings that we will need in our container-based applications. The service offerings include integrating your container applications or deployments to AWS services, for example, Load balancers, Auto Scaling, and CloudWatch. So I'm trying to tell you that your containers can have load balancing, autoscaling, container logs being pushed to CloudWatch, and many many more offerings. See ECS as your go-to tool for container deployments for small and large projects too. This article aims to explain the components that are in ECS because this service offering has some components that are built together to make it functional.
AWS Elastic Container Service has many features and components that back up its usage. Let's list out the core components and then explain each of them.
Task Definition
This is the blueprint of the application. This blueprint is from where the containers will be spun up. If you have prior knowledge of docker and multi-container deployments, you can directly compare task definitions to your docker-compose file. In the task definition, you can specify certain parameters such as the container image, the CPU, Volumes, Docker Networking, etc. ECS also allows you to pass an IAM role to tasks so they can safely interact with other AWS services without the need to pass Access keys or whatever to the tasks.
Service
Look at the service as the controller of the tasks. It acts as the guy that maintains the status of each task for example, if you specified in the service that you need 5 instances of a task (your container or sometimes a group of containers), the service ensures that the specified number is maintained. And if for whatever reason one of those tasks fails or crashes, the service will on its own, go and spin up another instance of the task to replace the failed task and ensure that the specified state is kept.
Since this service is a controller of the tasks, you can place the service behind a load balancer so you can evenly distribute traffic across the tasks that are associated with that service.
Cluster
According to AWS Documentation, this is the logical grouping of tasks or services. Now see the cluster as the underlying infrastructure that holds the tasks and their controller, the Service. The cluster contains Networking (VPC, subnets, Availability Zones), Monitoring options such as Cloudwatch metrics to collect logs from the tasks, and the Infrastructure Capacity. When I say Infrastructure Capacity, I am referring to the compute engine that will run the tasks and the services. In ECS, you have three options to choose from when it comes to working compute for your task definitions:
EC2 Instances
FARGATE (Serverless Compute)
On-Prem Virtual Machines or Servers
These three main components are what builds up a full ECS cluster. More knowledge an strategies can be added based on this basic knowledge of the services. Strategies such as Service Autoscaling, Service Load balancing, Service Deployments, If you wish to use EC2 launch types you can also look on Cluster AutoScaling.
This aricle is just an intro to the great service of ECS and it's components. I hope it helped you as a beginner to get a high end overview of the AWS service. if you have any uncertainty or corrections, feel free to reach out to me on twitter or X ๐ @sheriffexcel Thank you โจ