Amazon - Elastic Container Service(Deep Dive)
Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that provides the most secure, reliable and scalable way to run containerized applications.
Amazon ECS is a highly scalable, fast container management service that makes it easy to run, stop, and manage containers on a cluster. ECS comes with two launch types: EC2 and Fargate. The containers can run on a serverless infrastructure that is managed by AWS Fargate.
Amazon ECS eliminates the need for you to install and operate your own container orchestration software, manage and scale a cluster of virtual machines, or schedule containers on those virtual machines.
⚜️Components of Amazon ECS Works and How They Work?
Basic components of Amazon ECS are Docker containers running on EC2 instance or you could go serverless by lounging services and tasks using AWS Fargate. But before we go any further, to fully understand how Amazon ECS works and why it’s so powerful, one must first have to understand Docker.
Docker is a client-server development application that containerized applications in a lightweight environment containing all necessary dependencies that specific applications may need to run. Multiple different containers can be run on a single machine, making Docker very popular with developers when it comes to decoupling applications of running specific job types in batch.
⚜️AWS ECS -Task Definitions
To prepare your application to run on Amazon ECS, you need to create a task definition. A task definition is a text file (in JSON format) that describes one or more containers (up to 10) that make up your application. The job definition can specify various parameters for your containerized application. For example, you can use these parameters to indicate which containers to run, which ports should be open, which data volumes should be used, what Docker networking mode to use, and Identity and Access Management (IAM) roles. Almost everything you can run in a command-line Docker command can be defined using ECS task definitions.
⚜️AWS ECS -Tasks and Scheduling
A task is an instance of a task definition running in a cluster. After you create a task definition for your application in Amazon ECS, you can specify the number of tasks to run on your cluster. The Amazon ECS Task Scheduler is responsible for placing tasks in a cluster. There are two primary scheduler strategies: The REPLICA strategy places a desired number of tasks in your cluster, and maintains this number of tasks, restoring them if some of them fail. The DAEMON strategy places one task on each active container instance that meets the relevant criteria.
⚜️AWS ECS -Cluster
An Amazon ECS cluster is a logical grouping of services, each composed of one or more tasks. The first time you use Amazon ECS, a default cluster is created. You can create additional clusters in your account to achieve resource isolation for different workloads or projects. There are two ways to run cluster resources — on EC2 instances or via Amazon Fargate.
⚜️Container Agent — The container agent runs on each container instance in an Amazon ECS cluster. The agent sends information about currently running tasks, and resource utilization, to Amazon ECS. Amazon ECS can use the agent to start and stop tasks as needed.
AWS ECS Deployment Options: EC2 vs Fargate
ECS can use Elastic Compute Cloud (EC2) instances to run containers. EC2 instances are deployed as part of the Amazon EC2 service, and “registered” in a defined ECS cluster, meaning that EC2 can use those instances to deploy containers. You can run an ECS cluster within an existing VPC, making it accessible to existing AWS resources running in that VPC. An alternative way to deploy ECS containers is with Amazon Fargate. Fargate removes responsibility for provisioning, configuring, and managing EC2 instances, allowing AWS to manage EC2 instances for you. With Fargate you don’t need to manage servers, but you must ensure that task definitions are stateless.
🔅Common Use Case: Microservices
In order to handle increasing loads and scalability, teams are experimenting with microservice architecture by decoupling their monolithic apps. Thankfully Amazon ECS streamlines this process by providing administrators and engineers container orchestration capabilities to manage and control containerized independent services.
🔅Common Use Case: Batch Jobs
AWS Batch uses the Amazon ECS Agent to execute and carry out containerized jobs that run specific tasks. AWS Batch enables engineers to easily manage, run, and scale batch operations from tens to hundreds and thousands of containerized compute jobs.
THANK YOU !!