AWS Builder Center

Get Started with Amazon ECS!

This article explains the core components of Amazon ECS, AWS's container orchestration service (Cluster, Service, Task, Task Definition), along with the characteristics of its two launch types: Fargate and EC2.

Introduction

With the recent spread of cloud services, the use of public clouds (such as AWS and Google Cloud) has expanded, and it is now common to see workloads utilizing containers.
Therefore, this article will explain Amazon Elastic Container Service (ECS), the container service provided by AWS.
This content is designed for beginners, so if you're looking to start learning ECS, please give it a read!

Article Goal

Understand the basics of ECS.

What is ECS?

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications.

What is Container Orchestration?

Container orchestration is a technology that automatically manages and coordinates multiple containers.
The following diagram illustrates the differences with and without container orchestration.


ECS Core Components

  • Cluster
  • Service
  • Task
  • Task Definition


Cluster

A cluster is a logical group of resources for running containers on ECS.
Simply put, it's like a hosting environment for running your applications.


Service

A service is a mechanism that continuously runs a specified number of tasks (container applications) based on task definitions.
A service acts as a “manager,” monitoring the task and automatically launching a new one if it stops.


Task

A task is an application that is actually launched based on a task definition.
It's an execution unit consisting of one or more containers.


Task Definition

A task definition is a blueprint that defines how an application should be executed.
This is a template file describing all configuration information required for application execution in JSON format.


Amazon ECS launch types

The launch type specifies the management method for the underlying infrastructure used to run container applications.
There are primarily two options:
  • AWS Fargate
  • Amazon EC2 Instance

Fargate launch type

Fargate launch type is a method where AWS handles all server management.

Features of Fargate

  • Serverless
  • No need to manage EC2 instances
  • AWS automatically handles OS updates, security patching, and more
  • Pay-as-you-go
  • Charged only for actual CPU, memory, and runtime usage
  • No charges while tasks are stopped
  • Auto Scaling
  • Resources are automatically provisioned as needed
  • No capacity planning required

EC2 launch type

EC2 Launch Type is a method for running containers on EC2 instances that you manage yourself.

Features of EC2 launch type

  • Detailed Control
  • Freedom to choose EC2 instance types
  • Ability to use custom AMIs (Amazon Machine Images)
  • Cost Efficiency
  • Potential to reduce costs for applications running for extended periods
  • Utilization of Reserved Instances and Spot Instances
  • Advanced Configuration
  • Custom network settings
  • Support for specialized security requirements

Comparison of launch types

Based on the features described above, here's a comparison of the two launch types:
Comparison Item
Fargate
EC2
Server Management
Not Required
Required
Initial Setup
Task Definition Only
Task Definition + EC2 Configuration
Pricing Model
Task Execution Time
EC2 Instance Running Time
Scalability
Automatic/Unlimited
Manual/Limited
Customizability
Limited
High
Operational Overhead
Low
High
Cost Efficiency
Better for Short-term/Variable Workloads
Better for Long-term/Stable Workloads

Summary

  • What is ECS?
  • A fully managed container orchestration service provided by AWS
  • ECS Core Components
  • Cluster: A hosting environment for running applications
  • Service: A mechanism that continuously runs a specified number of tasks based on task definitions
  • Task: An application that is actually launched based on a task definition
  • Task Definition: A blueprint that defines how an application should be executed
  • ECS launch types
  • Fargate: Serverless approach with no server management required
  • EC2: Virtual machine approach where you manage servers yourself
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article