Amazon ECS のアイコン

Amazon ECS Popular2014年〜

A container orchestration service for easily running and managing containerized applications

What It Does

Amazon ECS (Elastic Container Service) is a fully managed container orchestration service for easily running, stopping, and managing Docker containers on AWS. It automatically handles container placement, scaling, health checks, and load balancing, letting developers focus on application development. You can choose between running on EC2 instances or running serverlessly with AWS Fargate.

Use Cases

It is used for building and operating microservices architectures, containerizing and deploying web applications to production, running batch processing and scheduled jobs in containers, setting up build and test environments in CI/CD pipelines, and migrating legacy applications to containers - covering all container-based scenarios.

Everyday Analogy

Think of it like a management system for a large logistics warehouse. It automatically handles decisions like which shelf (server) to place packages (containers) on, whether to replace damaged packages with new ones, and whether to add more shelves during busy periods. Instead of hiring a warehouse manager, ECS optimizes placement around the clock.

What Is ECS?

Amazon Elastic Container Service (ECS) is a fully managed container orchestration service from AWS. It simplifies the deployment, management, and scaling of Docker container-based applications. Announced in 2014, it has been adopted by many enterprises as AWS's native container management service. Unlike Kubernetes, it doesn't require complex configuration and features deep integration with AWS services.

Key Features

ECS's standout feature is seamless integration with the AWS ecosystem. Elastic Load Balancing for traffic distribution, CloudWatch for monitoring, and IAM for fine-grained access control are available out of the box. You can choose between two launch types: EC2 and Fargate. The EC2 launch type gives you fine control over instance types and sizes, while the Fargate launch type eliminates server management entirely. Task definitions - JSON configuration files - let you declaratively manage container CPU, memory, and network settings.

Task Definitions and Services

In ECS, the unit of application execution is called a "task." Task definitions specify the Docker image to use, CPU and memory allocation, environment variables, log settings, and more. A single task definition can include multiple containers, and the sidecar pattern for co-locating log collectors or proxies is common. Services manage long-running tasks, automatically maintaining the specified number of running tasks. If a task terminates abnormally, it is automatically restarted, and health checks are performed through load balancer integration. For the latest trends and practical techniques on task definitions and services, specialized books (Amazon) are also available.

Pricing

The ECS control plane itself has no additional charge. Costs are incurred for the infrastructure running your containers. With the EC2 launch type, you pay for the EC2 instances used. With the Fargate launch type, you pay based on the vCPU and memory allocated and the duration of use. Fargate charges by the second with a 1-minute minimum, using a pay-for-what-you-use model. Fargate Spot can provide up to 70% discount off regular pricing.

Getting Started

To get started with ECS, open the ECS dashboard in the AWS Management Console and begin with 'Create cluster.' A cluster is a logical group for running tasks. Next, create a task definition specifying the Docker image URL, CPU and memory allocation, port mappings, and more. You can specify your own images pushed to Amazon ECR or public images from Docker Hub. Create a service and specify the desired task count, and ECS automatically launches and manages your containers.

Things to Watch Out For

  • The EC2 launch type requires instance management, so consider the Fargate launch type if you want to reduce operational overhead
  • Use task definition revision management so you can roll back when configuration changes cause issues
  • It is recommended to configure container logs to output to CloudWatch Logs. This is essential for investigating the cause of failures
共有するXB!