Deploying with ECS
As described earlier in this chapter, ECS takes care of deploying Docker images automatically, and sets up all the services needed around the instances.
You do not need, in this case, to create EC2 instances yourself. ECS uses its own AMI, which is tweaked to run Docker containers on EC2. It is pretty similar to CoreOS, as it comes with a Docker daemon, but it is integrated with the AWS infrastructure for sharing configuration and triggering events.
An ECS cluster deployment is composed of many elements:
- An Elastic Load Balancer (in EC2) to distribute the requests among the instance
- A Task Definition, which is used to determine which Docker image needs to be deployed, and what ports should be bound between the host and the container
- A Service, which uses the Task Definition to drive the creation of EC2 instances, and run the Docker container in them
- A Cluster, which groups Services, Task Definitions, and an ELB
Deploying a cluster on ECS when you are not used to it is complex...