Sitemap

AWS ECS (Elastic Container Service)

4 min readSep 6, 2024

--

This AWS ECS tutorial will walk you through the basics of Amazon Elastic Container Service (Amazon ECS), a highly scalable and fast container management service. ECS is responsible for managing a container's lifecycle, from creation to destruction.

ECS is designed to be a simpler alternative to some of the other more complex container orchestrators like Kubernetes, Hashicorp Nomad, and Apache Mesos. With ECS there’s no need to master complex deployment architectures, deploying a containerized application is as easy as a few clicks.

ECS is a managed container orchestrator.

Why Orchestrator?

  • Manage the lifecycle of containers Create/restart/destroy.
  • Deploy & load-balance application across multiple servers
  • Autoscaling to handle variance in traffic
  • Rolling out changes to the application

ECS vs Others

Press enter or click to view image in full size

Plain docker environment, what happens is you write docker-compose file with all the configuration and there different servers, you can only deploy the application to one server but you cannot scale it to all the servers, you can copy to other server but you are truly not orchestrating the container. orchestrator can auto scale up and down depending on the traffic and docker-compose does not have this capability to do this.

Press enter or click to view image in full size

Compared to other tools like you know kubernetes operation and architecture and understanding is tougher compared to ECS, ECS was built to make things very simple.

ECS Infrastructure and launch

ECS has two launch types

  • EC2 Base launch type
  • Fargate Service

ECS Cluster

Get Sailesh Ramesh’s stories in your inbox

Join Medium for free to get updates from this writer.

Well to understand ECS Cluster, Let’s know how ECS works in itself, it is the brains behind how containers are deployed, when you deploy a container it has to run on a physical virtual machine. ECS doesn’t have a server/compute power it can only create and delete containers. So, that is where ECS Cluster comes it has basically the underlying infrastructure to run the containers.

Press enter or click to view image in full size

EC2 Launch type — We have to manage the underlying EC2 instances, You still need to manage the underlying infrastructure (EC2) like installing docker, ECS Agent, firewall and Patches.

ECS Fargate

Press enter or click to view image in full size

AWS manages the underlying infrastructure. You are going to have ECS Control Plane, Fargate and Cluster (No EC2 Instances). Basically follows a serverless architecture. Fargate will create servers on demand and then ECS can deploy the containers on the cluster and the good part is you pay for what you use.

ECS Task Definition

Press enter or click to view image in full size

As a user, you have an application and your going to dockerize it by dockerfile and once you have the image your going to upload it to ECR/DockerHub and you have to define the Task Definition within the ECS, you are going to define the blueprint that describes how containers should launch, how much CPU/MEM and image/ports/Volumes.

Task

Task Definition is just the blueprint for our container and how it should be deployed. A task is an instance of a Task Definition, a running container(s) with settings defined in the Task Def

ECS Services

Press enter or click to view image in full size

A service ensures that a certain number of Tasks are running at all times. Restarts containers that have exited/crashed. EC2 instance fails, the service will restart on a working EC2 instance.

Load Balancers

Press enter or click to view image in full size

A Load Balancer can be assigned to route external traffic to your service.

Thank you for reading this far

Feel free to connect on LinkedIN

Regards, Sailesh Ramesh

--

--

Sailesh Ramesh
Sailesh Ramesh

Written by Sailesh Ramesh

Enthusiastic Software Engineer with a deep fascination for the ever-evolving world of technology!