ECS
AWS 네이티브 컨테이너 오케스트레이션. EC2 또는 Fargate 위에서 구동
이게 뭔가요? / What is this?
ECS는 물리 장비가 아니라, 여러 개의 도커 컨테이너를 언제 어디서 실행할지 지시하고 관리하는 관제 서비스(오케스트레이터)입니다. 오케스트라 지휘자가 직접 악기를 연주하지 않고 각 연주자에게 신호를 주듯, ECS는 실제 컴퓨팅(EC2나 Fargate)을 직접 만들지 않고 그 위에서 컨테이너들의 시작·중지·배치를 지휘합니다.
개요 / Overview
ECS는 도커 컨테이너를 태스크·서비스 단위로 실행하는 관리형 오케스트레이터입니다. 시험에서는 "컨테이너로 마이그레이션", "Lambda 15분 초과 작업"에서 등장합니다. 시작 유형이 EC2면 인스턴스를 직접 관리하고, Fargate면 서버 관리가 사라집니다.
동작 원리 / How it works
ECS는 태스크 정의(컨테이너 이미지, CPU·메모리, 포트, 환경 변수, IAM 역할을 적은 명세)를 받아 클러스터 안에 태스크로 실행합니다. 서비스는 "이 태스크를 항상 N개 유지하라"는 선언이며, 죽으면 다시 띄우고 ALB 대상 그룹에 등록·해제하는 일까지 처리합니다.
실행 위치는 시작 유형이 결정합니다. EC2 시작 유형에서는 여러분이 컨테이너 인스턴스(ECS 에이전트가 깔린 EC2)를 직접 운영하고, ECS는 그 위에 태스크를 배치합니다. Fargate 시작 유형에서는 호스트가 보이지 않고 태스크당 vCPU·메모리를 선언하면 AWS가 실행 환경을 대신 준비합니다. 같은 태스크 정의를 두 방식 모두에서 쓸 수 있어, 시험은 "어느 쪽이 요구에 맞는가"만 묻습니다.
시험은 무엇을 보는가 / What the exam is testing
컨테이너 문제에서 시험이 보는 것은 두 갈래입니다. 하나는 ECS와 EKS 중 무엇인가 — 쿠버네티스가 명시되지 않으면 ECS가 운영 부담이 낮아 정답입니다. 다른 하나는 EC2와 Fargate 중 무엇인가 — 관리 부담 최소화면 Fargate, 최저 비용이고 사용률이 높으면 EC2 + Spot입니다.
시험 포인트 / Exam points
EC2 시작 유형은 인스턴스를 직접 패치·확장해야 하지만 Spot·RI로 비용을 크게 낮출 수 있습니다. Fargate는 서버가 아예 보이지 않아 운영 부담이 최소이고, 문제에 "인프라 관리 없이"가 있으면 Fargate가 정답입니다.
태스크 역할(Task Role)은 컨테이너 안의 애플리케이션이 S3 등 AWS API를 호출할 때 쓰는 권한입니다. 실행 역할(Execution Role)은 ECS 에이전트가 ECR에서 이미지를 당기고 CloudWatch에 로그를 쓸 때 쓰는 권한으로, 둘은 별개입니다.
한 EC2 호스트에 같은 컨테이너를 여러 개 띄우려면 ALB의 동적 포트 매핑을 씁니다. 대상 그룹이 각 태스크의 임의 포트로 라우팅해 밀도를 높입니다.
자주 틀리는 함정 / Common traps
태스크 역할과 실행 역할을 혼동하는 것 — 컨테이너 안 코드가 S3를 못 읽는 문제의 원인은 태스크 역할이고, ECR에서 이미지를 못 당기는 문제의 원인은 실행 역할입니다.
한 호스트에 같은 컨테이너를 여러 개 띄우려는데 호스트 포트를 고정하는 것 — 포트 충돌로 두 번째 태스크가 뜨지 않습니다. ALB 동적 포트 매핑을 써야 합니다.
헷갈리는 것 구분하기 / Telling them apart
문제에 Kubernetes·kubectl·Helm·기존 매니페스트가 언급되면 EKS, 그냥 "컨테이너"면 ECS입니다. EKS는 컨트롤 플레인 시간당 요금과 쿠버네티스 자체의 학습·운영 부담이 추가로 붙습니다.
Amazon ECS
AWS-native container orchestration on either EC2 or Fargate
이게 뭔가요? / What is this?
ECS is not physical hardware — it is a control service (an orchestrator) that tells a fleet of Docker containers when and where to run. Like a conductor who never plays an instrument but signals every musician, ECS never supplies the underlying compute itself (that is EC2 or Fargate) — it just directs the starting, stopping, and placement of containers on top of it.
개요 / Overview
ECS is a managed orchestrator that runs Docker containers as tasks and services. It appears in "migrate to containers" scenarios and where Lambda exceeds 15 minutes. The EC2 launch type means you manage instances; Fargate removes servers entirely.
동작 원리 / How it works
ECS takes a task definition — image, CPU and memory, ports, environment variables, IAM roles — and runs it as a task in a cluster. A service declares "keep N of this task running", restarting failures and registering or draining targets in an ALB target group.
Where it runs depends on the launch type. With EC2 you operate the container instances (EC2 hosts running the ECS agent) and ECS places tasks on them. With Fargate there is no visible host: you declare vCPU and memory per task and AWS provides the runtime. The same task definition works either way, so the exam only asks which side fits the requirement.
시험은 무엇을 보는가 / What the exam is testing
Container questions fork twice. First ECS or EKS: without an explicit Kubernetes signal, ECS wins on lower overhead. Second EC2 or Fargate: minimise overhead → Fargate; lowest cost at high utilisation → EC2 with Spot.
시험 포인트 / Exam points
The EC2 launch type means you patch and scale instances yourself but can cut cost with Spot or RIs. Fargate hides servers entirely; when the question says "without managing infrastructure", Fargate is the answer.
The task role grants the application inside the container permission to call AWS APIs such as S3. The execution role lets the ECS agent pull images from ECR and write logs to CloudWatch. They are separate.
To run several copies of a container on one host, use ALB dynamic port mapping; the target group routes to each task's ephemeral port, raising density.
자주 틀리는 함정 / Common traps
Confusing the task role with the execution role — code inside the container failing to read S3 is a task-role problem; failing to pull from ECR is an execution-role problem.
Pinning a host port while trying to run several copies of a container on one host — the second task fails on a port conflict. Use ALB dynamic port mapping.
헷갈리는 것 구분하기 / Telling them apart
A mention of Kubernetes, kubectl, Helm, or existing manifests means EKS; plain "containers" means ECS. EKS adds an hourly control-plane charge plus the operational weight of Kubernetes itself.
AWS SAA Hub Pro는 독립 학습 자료이며 Amazon Web Services, Inc.의 공식 서비스가 아닙니다. 시험 정책과 서비스 사양은 AWS 공식 문서를 기준으로 확인하세요.