Amazon Elastic Container (AWS ECS) is the AWS Docker container service that handles the orchestration and provisioning of Docker containers. This is a beginner level introduction to AWS ECS.
AWS ECS is a container management service to run, stop, and manage Docker containers on a cluster.
ECS can be used to create a consistent deployment and build experience, manage, and scale batch and Extract-Transform-Load (ETL) workloads, and build sophisticated application architectures on a microservices model. Amazon ECS is a regional service.
Amazon Elastic Container Service (ECS) is, according to Amazon,
“a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster. ”
It is comparable to Kubernetes, Docker Swarm, and Azure Container Service.
AWS ECS runs your containers on a cluster of Amazon EC2 (Elastic Compute Cloud) virtual machine instances pre-installed with Docker. It handles installing containers, scaling, monitoring, and managing these instances through both an API and the AWS Management Console. It allows you to simplify your view of EC2 instances to a pool of resources, such as CPU and memory. The specific instance a container runs on, and maintenance of all instances, is handled by the platform. You don’t have to think about it.
AWS ECS Benefits:
1) Lower your compute cost: No additional charge for ECS beyond the amount paid for compute resources. Amazon ECS can autonomously handle the provisioning and auto-scaling, which can help lower your compute costs by up to 50%.
2) No control plane or nodes to manage: Control of the ECS cluster can be done through a web-based GUI or the command line interface. Amazon ECS is serverless by default with AWS Fargate, which means you’ll spend less time on operations because there’s no control plane or nodes to manage, and no instances to patch and scale.
3) Use your existing tools: Amazon ECS is the easiest way to rapidly launch thousands of containers using your preferred CI/CD and automation tools.
4) Meet security and regulatory requirements: Integration with Identity and Access Management and other AWS services.
AWS ECS Concepts:
1) Task Definition: Task Definition is the combination of a container image and its runtime parameters. This is the blueprint describing which Docker containers to run and represents your application
2) Task: Task is a running instance of a task definition. Multiple Tasks can be created by one Task Definition, as demand requires.
3) Service: Service runs and maintains a specified number of tasks. Defines the minimum and maximum Tasks from one Task Definition run at any given time, autoscaling, and load balancing. There are two deployment strategies in ECS:
i) Rolling Update: This involves the service scheduler replacing the current running version of the container with the latest version.
The number of tasks ECS adds or removes from the service during a rolling update is controlled by the deployment configuration, which consists of the minimum and maximum number of tasks allowed during a service deployment.
ii) Blue/Green Deployment with AWS CodeDeploy: This deployment type allows you to verify a new deployment of a service before sending production traffic to it.
The service must be configured to use either an Application Load Balancer or Network Load Balancer.
4) Cluster: Cluster is a logical grouping of tasks and services combined with a compute resources called a service provider. A Cluster can run many Services. If you have multiple applications as part of your product, you may wish to put several of them on one Cluster. This makes more efficient use of the resources available and minimizes setup time.
5) Container Agent: This is just an EC2 instance that is part of an ECS Cluster and has docker and the ecs-agent running on it. It sends information about the resource’s current running tasks and resource utilization to ECS and starts and stops tasks whenever it receives a request from ECS. Container agent is only supported on Amazon EC2 instances.
6) Service Load Balancing: AWS ECS services support the Application Load Balancer, Network Load Balancer, and Classic Load Balancer ELBs. Application Load Balancers are used to route HTTP/HTTPS (or layer 7) traffic. Network Load Balancers are used to route TCP or UDP (or layer 4) traffic. Classic Load Balancers are used to route TCP traffic.
AWS ECS – Use cases:
A. Run microservices:
• Ability to run multiple docker containers on the same machine
• Easy service discovery features to enhance communication
• Direct integration with Application Load Balancers
B. Auto scaling capability:
• Run batch processing / scheduled tasks
• Schedule ECS containers to run on On-demand / Reserved / Spot instances
C. Migrate applications to the cloud:
• Dockerize legacy applications running on premise
• Move Docker containers to run on ECS
We can achiever AWS ECS using below: