AWS Elastic Container Service

AWS ECS (Elastic Container Service) is a fully managed container orchestration service, designed to simplify the deployment, scaling, and management of containerized applications.

AWS ECS is a fully managed container orchestration service that makes deploying and managing containerized applications in the cloud easy. With ECS, you can use popular container technologies like Docker and Kubernetes and quickly scale your applications as your business grows.

ECS automates the deployment and management of your containers, so you don’t have to worry about the underlying infrastructure. It integrates with other AWS services like ECR to store and manage container images and CloudWatch to monitor container performance.

ECS provides powerful features such as auto-scaling, load balancing, and task scheduling, which make it easy to manage a fleet of containers. And because it’s a fully managed service, AWS takes care of the underlying infrastructure and provides 24/7 support so that you can focus on your applications and your business.

Task Definition

In AWS ECS, a task definition is a blueprint that describes how to run a Docker container as a task within a service. It defines the container image, CPU and memory requirements, networking settings, environment variables, and other details needed to run a container in ECS.

A task definition can be considered a template or configuration file specifying the instructions for running a container in ECS.

When you create a task definition, you can specify one or more containers to run together, their resource requirements, and how they interact.

Once you have created a task definition, you can use it to launch tasks on an ECS cluster, either manually or through a service. When you launch a task using a task definition, ECS reads it and creates the container or containers defined within it, along with any associated resources such as networking or storage.

Overall, task definitions are a key component of AWS ECS, providing a flexible and scalable way to define and manage Docker containers within an ECS cluster.

Service

In AWS ECS, a service is a way to define and manage a group of tasks that perform the same function. A service is a long-running task that runs multiple instances of a task definition, ensuring that the specified number of tasks are always running and automatically replacing any failed or stopped tasks.

A service in ECS provides a scalable and highly available way to manage containers running on an ECS cluster. You can use a service to define the desired number of tasks, the task definition to use, and how tasks are distributed across the cluster.

When creating a service, you specify the task definition it should use and the desired number of tasks to run. ECS automatically manages the placement of the tasks on the cluster and ensures that the specified number of tasks are always running, even if an underlying EC2 instance fails.

In addition to ensuring the desired number of tasks are running, a service can automatically manage tasks running on an outdated version of a task definition. This allows you to easily update your application by simply updating the task definition associated with your service.

Overall, a service in AWS ECS is a powerful way to manage and scale containers running on an ECS cluster. It provides a scalable and highly available method to ensure that the desired number of tasks are always running and can help you easily manage updates and changes to your application.

Compute

When you use ECS, you can choose between two different computing options:

EC2 Launch Type: This is the traditional launch type for ECS, and it runs containers on a fleet of EC2 instances you manage. With the EC2 launch type, you have more control over the underlying infrastructure, but you must also manage the EC2 instances yourself.

Fargate Launch Type: This serverless launch type for ECS allows you to run containers without managing any underlying infrastructure. With the Fargate launch type, AWS manages the EC2 instances for you, and you only pay for the resources your containers use.

Application Load Balancer

When you run containers on AWS ECS, each container is assigned an IP address within the VPC where the ECS cluster runs. You can use this IP address to access the container directly, but this approach is not recommended because the IP address can change when the container is stopped or restarted.

Instead, it is recommended to use an Application Load Balancer (ALB) to distribute traffic to the containers running on ECS. An ALB acts as a single point of entry for incoming traffic, and it can distribute traffic across multiple containers running on different EC2 instances or availability zones. This approach provides better scalability, fault tolerance, and security for your application.

References

Amazon Elastic Container Service Documentation

Last modified July 21, 2024: update (e2ae86c)