Most of the time when someone introduces ECS to you it goes something like this. Here are all the terms:
Summary of the ECS Terms
Task Definition — This a blueprint that describes how a docker container should launch. If you are already familiar with AWS, it is like a LaunchConfig except instead it is for a docker container instead of an instance. It contains settings like exposed port, docker image, CPU shares, memory requirement, the command to run and environmental variables.
Task — This is a running container with the settings defined in the Task Definition. It can be thought of as an “instance” of a Task Definition.
Service — Defines long-running tasks of the same Task Definition. This can be one running container or multiple running containers all using the same Task Definition.
Cluster — A logic group of EC2 instances. When an instance launches the ecs-agent software on the server registers the instance to an ECS Cluster. This is easily configurable by setting the ECS_CLUSTER variable in /etc/ecs/ecs.config described here.
Container Instance — This is just an EC2 instance that is part of an ECS Cluster and has docker and the ecs-agent running on it.
I remember when I first got introduced to the all the terms, it was a little bit overwhelming. How does it feel when you are learning a subject for the first time, and you are thrown a dictionary of terms? It’s a little hard to learn that way.
Though AWS provides some excellent detailed diagrams to help explain the ECS and the terms, I was looking for something simpler. Here is a simplified diagram to help visualize and explain the terms:
In this diagram, you can see that there are 4 running Tasks or Docker containers. They are part of an ECS Service. The Service and Tasks span 2 Container Instances. The Container Instances are part of a logical group called an ECS Cluster.
I did not show a Task Definition in the diagram because a Task is simply an “instance” of Task Definition.
I hope this diagram helps others.