Photo by Chor Tsang
How's everyone doing? This section I have to admit is the one that I found the most difficult to understand all of the concepts within ECS so I hope that my notes will help explaining it in a simple way. Let's get started.
What AWS ECS (Elastic Container Service)?
Task Definitions are metadata in JSON format that give instructions to ECS on how to run a Docker container.
The contain crucial information about image names, port bindings for container and host, memory and cpu required, environment variables and networking information
We can configure the way tasks run and also how many should run and spread them amongst your EC2 instances and can also be linked to load balancers
We need to create an ECS Cluster in which we add services and task definitions
Clusters can be of type EC2 or Fargate. For EC2 Clusters the corresponding EC2 instance are automatically created along with an autoscaling group
Let's talk about AWS ECR (Elastic Container Registry) which is a private repo for storing our Docker images
It is used for creating custom images locally and then push them to ECR so that they are available to use in ECS
To create a repo, in our CLI we need to
Let's talk about AWS ECS with Fargate
Fargate is a Serverless way of launching ECS Clusters
We only create the task definitions and AWS will run our containers. To scale we only increase the task number
We don't have to worry about managing EC2 instances anymore
Let's talk about ECS tasks placement
Task placement strategy: Determine where to place newly launched EC2 type tasks. Task placement constraints: Based on CPU, memory and available port. The same logic constraints also apply when scaling in and need to terminate tasks
Now about Task placement strategies we have
Most of these concepts mentioned above may not make perfect sense if you don't see them being applied on the AWS console but still they are good theory to know. Maybe that can be a future version of this sets of tutorials :)
Next week we're talking about Elastic Beanstalk where things start getting more interesting as we can see combination of several services.