Task Definition:
A bunch of containers logically bundled together
- i.e. Nginx + MVC + DB for Traditional stack
- i.e. service + optional db for Miscroservices
NetWork Mode:
-
Bridge -- Fork the connection on host's network stack, will have individual IP for container
-
Host -- Share same Network connection with host, faster, but forced port mapping
Longer Version See Network Mode
Post Mapping:
If you want to run multiple instance of the same container, You probably want running all of them at the same port, but at different IP address, but with same port number.
If you enable host mode, see above network mode If you enable port mapping, you may run into conflict with host port already in use, either by other services or by another instance of the same instance. Make sure the host part is left empty for port mapping. The container part is necessary, since ECS uses that to define the container instance's port exposure. With no port exposed, you can't use a load balancer.
ECS will let you dig a hole for yourself. You will be able to create a task definition with port mapping and just one container, specify your target instance a service definition with more than 1 instance of that task running. ECS will only run one instance of that task on a cluster of only 1 node. This will work if desired instance count for cluster is set to 2.
Services
It is just as it suggests, a service, a poorly defined term in IT. My understanding, a Service as a Service Oriented Architecture. Bundling all your individual pieces/tasks together, to enable something usable and scalable.
The number of task is the minimal expected amount of tasks running. If the number is not set to 0, you can't delete the service. You have to update the service, set the number to 0, then delete it.
Load Balancing
Make sure your Load Balancer, Load Balancer Target Group and your cluster instances running
the cluster is on the same VPC, other wise you will have a silent failure of Error: InvalidTarget
.